Skip to content

Commit ef4eb89

Browse files
committed
Revert "Upgrade to TypeScript 2.1, and latest grunt-ts. (NativeScript#3609)"
This reverts commit 79e6881.
1 parent 79e6881 commit ef4eb89

23 files changed

+4475
-85
lines changed

apps/references.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
/// <reference path="../tns-platform-declarations/ios.d.ts" />
33

44
/// <reference path="../tns-core-modules/tns-core-modules.d.ts" />
5+
/// <reference path="../tns-core-modules/lib.core.d.ts" />
6+
/// <reference path="../tns-core-modules/lib.dom.d.ts" />
7+
58
/// <reference path="../tns-core-modules/ui/styling/css-selector-parser.d.ts" />

gruntfile.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ module.exports = function(grunt) {
9191
var angularExcludes = angularConflicts.map(function(file) {
9292
return '!' + file;
9393
});
94+
var nonES6Files = [
95+
'es-collections.d.ts',
96+
'es6-promise.d.ts',
97+
'es6.d.ts',
98+
'weakmap.d.ts',
99+
];
100+
var es6Excludes = nonES6Files.map(function(file) {
101+
return '!' + file;
102+
});
94103
var dtsFiles = grunt.file.expand({cwd: srcDir }, [
95104
"**/*.d.ts",
96105
//Exclude the d.ts files in the apps folder - these are part of the apps and are already packed there!
@@ -108,13 +117,13 @@ module.exports = function(grunt) {
108117
"!tns-core-modules.base.d.ts",
109118
"!references.d.ts",
110119
"!webworker.es2016.d.ts"
111-
].concat(localCfg.defaultExcludes).concat(angularExcludes));
120+
].concat(localCfg.defaultExcludes).concat(es6Excludes).concat(angularExcludes));
112121
dtsFiles.sort();
113122

114123
writeDtsFile(dtsFiles, outDir, 'tns-core-modules/tns-core-modules.base.d.ts');
115124
var es6Files = angularConflicts.concat(['tns-core-modules.base.d.ts']);
116125
writeDtsFile(es6Files, outDir, 'tns-core-modules/tns-core-modules.es6.d.ts');
117-
var allFiles = angularConflicts.concat(['tns-core-modules.base.d.ts']);
126+
var allFiles = angularConflicts.concat(nonES6Files).concat(['tns-core-modules.base.d.ts']);
118127
writeDtsFile(allFiles, outDir, 'tns-core-modules/tns-core-modules.d.ts');
119128
}
120129

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
"grunt-env": "0.4.4",
1717
"grunt-exec": "1.0.1",
1818
"grunt-mkdir": "1.0.0",
19+
"grunt-multi-dest": "1.0.0",
1920
"grunt-shell": "2.1.0",
20-
"grunt-ts": "6.0.0-beta.11",
2121
"grunt-simple-mocha": "0.4.1",
22+
"grunt-ts": "5.3.2",
2223
"grunt-tslint": "4.0.0",
2324
"grunt-typedoc": "0.2.4",
25+
"grunt-untar": "0.0.1",
2426
"http-server": "^0.9.0",
2527
"markdown-snippet-injector": "0.1.1",
2628
"mocha": "2.2.5",
@@ -29,7 +31,7 @@
2931
"time-grunt": "1.3.0",
3032
"tslint": "^4.4.2",
3133
"typedoc": "0.4.5",
32-
"typescript": "~2.1.5"
34+
"typescript": "~2.0.10"
3335
},
3436
"scripts": {
3537
"setup": "npm run dev-link-tns-platform-declarations && npm run dev-link-tns-core-modules && npm run dev-link-tests && npm run dev-link-apps",

tests/app/ui/animation/animation-tests.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {Label} from "ui/label";
55
import {StackLayout} from "ui/layouts/stack-layout";
66
import colorModule = require("color");
77
import enums = require("ui/enums");
8-
import { AnimationPromise } from "ui/animation";
98

109
// >> animation-require
1110
import animation = require("ui/animation");
@@ -106,7 +105,7 @@ export function test_CancellingAnimate(done) {
106105
}
107106
// << (hide)
108107
});
109-
(<AnimationPromise>animation1).cancel();
108+
animation1.cancel();
110109
// << animation-cancel2
111110
}
112111

@@ -485,4 +484,4 @@ function assertIOSNativeTransformIsCorrect(view: viewModule.View) {
485484
TKUnit.assert(false, errorMessage);
486485
}
487486
}
488-
}
487+
}

tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"version": "2.4.0"
1010
},
1111
"tns-android": {
12-
"version": "2.5.0"
12+
"version": "2.4.1"
1313
}
1414
},
1515
"dependencies": {
@@ -24,4 +24,4 @@
2424
"lazy": "1.0.11",
2525
"typescript": "~2.0.10"
2626
}
27-
}
27+
}

tests/references.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
/// <reference path="../tns-platform-declarations/ios.d.ts" />
33

44
/// <reference path="../tns-core-modules/tns-core-modules.d.ts" />
5+
/// <reference path="../tns-core-modules/lib.core.d.ts" />
6+
/// <reference path="../tns-core-modules/lib.dom.d.ts" />
7+
58
/// <reference path="../tns-core-modules/ui/styling/css-selector-parser.d.ts" />

tns-core-modules/declarations.d.ts

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,6 @@ declare class Headers {
4242
set(name: string, value: string): void;
4343
}
4444

45-
interface Blob {
46-
readonly size: number;
47-
readonly type: string;
48-
msClose(): void;
49-
msDetachStream(): any;
50-
slice(start?: number, end?: number, contentType?: string): Blob;
51-
}
52-
53-
declare var Blob: {
54-
prototype: Blob;
55-
new (blobParts?: any[], options?: BlobPropertyBag): Blob;
56-
}
57-
58-
interface BlobPropertyBag {
59-
type?: string;
60-
endings?: string;
61-
}
62-
6345
declare class Body {
6446
bodyUsed: boolean;
6547
/*
@@ -98,6 +80,10 @@ declare type RequestInfo = Request|string;
9880

9981
declare function fetch(url: string, init?: RequestInit): Promise<Response>;
10082

83+
interface XMLHttpRequest {
84+
send(data?: FormData): void;
85+
}
86+
10187
interface Console {
10288
time(reportName: string): void;
10389
timeEnd(reportName: string): void;
@@ -180,7 +166,3 @@ declare var exports: any;
180166
interface Array<T> {
181167
filter<U extends T>(pred: (a: T) => a is U): U[];
182168
}
183-
184-
//Dialogs
185-
declare function alert(message?: any): void;
186-
declare function confirm(message?: string): boolean;
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/* tslint:disable */
2+
/////////////////////////////
3+
/// IE11 ECMAScript Extensions
4+
/////////////////////////////
5+
6+
interface List<T> extends Array<T> {}
7+
8+
interface Map<K, V> {
9+
clear(): void;
10+
delete(key: K): boolean;
11+
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
12+
get(key: K): V;
13+
has(key: K): boolean;
14+
set(key: K, value: V): Map<K, V>;
15+
size: number;
16+
keys(): Array<K>;
17+
values(): Array<V>;
18+
}
19+
declare var Map: {
20+
new <K, V>(): Map<K, V>;
21+
22+
// needed by Angular
23+
// alexeagle: PATCHED
24+
new<K, V>(m: Map<K, V>): Map<K, V>;
25+
new<K, V>(l: List<any>): Map<K, V>;
26+
prototype: Map<any, any>;
27+
}
28+
29+
//For compatibility - some libs insist on the Map/Set types being named that way
30+
declare type MapConstructor = typeof Map;
31+
declare type SetConstructor = typeof Set;
32+
33+
interface Set<T> {
34+
add(value: T): Set<T>;
35+
clear(): void;
36+
delete(value: T): boolean;
37+
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
38+
has(value: T): boolean;
39+
size: number;
40+
}
41+
declare var Set: {
42+
new <T>(): Set<T>;
43+
44+
// needed by Angular
45+
// alexeagle PATCHED
46+
new<T>(s: Set<T>): Set<T>;
47+
new<T>(l: List<T>): Set<T>;
48+
prototype: Set<any>;
49+
}
50+
51+
//Compatibility interfaces for rxjs
52+
interface IteratorResult<T> {
53+
done: boolean;
54+
value?: T;
55+
}
56+
57+
interface Iterator<T> {
58+
next(value?: any): IteratorResult<T>;
59+
return?(value?: any): IteratorResult<T>;
60+
throw?(e?: any): IteratorResult<T>;
61+
}

tns-core-modules/es6-promise.d.ts

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
/* tslint:disable */
2+
// Type definitions for es6-promise
3+
// Project: https://github.com/jakearchibald/ES6-Promise
4+
// Definitions by: François de Campredon <https://github.com/fdecampredon/>
5+
// Definitions: https://github.com/borisyankov/DefinitelyTyped
6+
interface PromiseLike<T> {
7+
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => PromiseLike<U>): PromiseLike<U>;
8+
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => U): PromiseLike<U>;
9+
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => void): PromiseLike<U>;
10+
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => PromiseLike<U>): PromiseLike<U>;
11+
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U): PromiseLike<U>;
12+
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => void): PromiseLike<U>;
13+
}
14+
15+
interface Promise<T> extends PromiseLike<T> {
16+
/**
17+
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
18+
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
19+
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
20+
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
21+
* If an error is thrown in the callback, the returned promise rejects with that error.
22+
* @param onFulfilled called when/if "promise" resolves
23+
* @param onRejected called when/if "promise" rejects
24+
*/
25+
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => PromiseLike<U>): Promise<U>;
26+
/**
27+
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
28+
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
29+
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
30+
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
31+
* If an error is thrown in the callback, the returned promise rejects with that error.
32+
* @param onFulfilled called when/if "promise" resolves
33+
* @param onRejected called when/if "promise" rejects
34+
*/
35+
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => U): Promise<U>;
36+
/**
37+
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
38+
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
39+
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
40+
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
41+
* If an error is thrown in the callback, the returned promise rejects with that error.
42+
* @param onFulfilled called when/if "promise" resolves
43+
* @param onRejected called when/if "promise" rejects
44+
*/
45+
then<U>(onFulfilled?: (value: T) => PromiseLike<U>, onRejected?: (error: any) => void): Promise<U>;
46+
/**
47+
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
48+
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
49+
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
50+
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
51+
* If an error is thrown in the callback, the returned promise rejects with that error.
52+
* @param onFulfilled called when/if "promise" resolves
53+
* @param onRejected called when/if "promise" rejects
54+
*/
55+
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => PromiseLike<U>): Promise<U>;
56+
/**
57+
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
58+
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
59+
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
60+
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
61+
* If an error is thrown in the callback, the returned promise rejects with that error.
62+
* @param onFulfilled called when/if "promise" resolves
63+
* @param onRejected called when/if "promise" rejects
64+
*/
65+
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => U): Promise<U>;
66+
/**
67+
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
68+
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
69+
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
70+
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
71+
* If an error is thrown in the callback, the returned promise rejects with that error.
72+
* @param onFulfilled called when/if "promise" resolves
73+
* @param onRejected called when/if "promise" rejects
74+
*/
75+
then<U>(onFulfilled?: (value: T) => U, onRejected?: (error: any) => void): Promise<U>;
76+
77+
/**
78+
* Sugar for promise.then(undefined, onRejected)
79+
* @param onRejected called when/if "promise" rejects
80+
*/
81+
catch<U>(onRejected?: (error: any) => PromiseLike<U>): Promise<U>;
82+
/**
83+
* Sugar for promise.then(undefined, onRejected)
84+
* @param onRejected called when/if "promise" rejects
85+
*/
86+
catch<U>(onRejected?: (error: any) => U): Promise<U>;
87+
/**
88+
* Sugar for promise.then(undefined, onRejected)
89+
* @param onRejected called when/if "promise" rejects
90+
*/
91+
catch<U>(onRejected?: (error: any) => void): Promise<U>;
92+
}
93+
94+
interface PromiseConstructor {
95+
/**
96+
* A reference to the prototype.
97+
*/
98+
prototype: Promise<any>;
99+
100+
/**
101+
* Creates a new Promise.
102+
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
103+
* a resolve callback used resolve the promise with a value or the result of another promise,
104+
* and a reject callback used to reject the promise with a provided reason or error.
105+
*/
106+
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
107+
108+
/**
109+
* Returns promise (only if promise.constructor == Promise)
110+
*/
111+
cast<T>(promise: Promise<T>): Promise<T>;
112+
/**
113+
* Make a promise that fulfills to obj.
114+
*/
115+
cast<T>(object: T): Promise<T>;
116+
117+
/**
118+
* Make a new promise from the PromiseLike.
119+
* A promise-like can be anything as far as it has a "then" method.
120+
* This also creates a new promise if you pass it a genuine JavaScript promise, making it less efficient for casting than Promise.cast.
121+
*/
122+
resolve<T>(promise?: PromiseLike<T>): Promise<T>;
123+
/**
124+
* Make a promise that fulfills to obj. Same as Promise.cast(obj) in this situation.
125+
*/
126+
resolve<T>(object?: T): Promise<T>;
127+
128+
/**
129+
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
130+
*/
131+
reject(error: any): Promise<any>;
132+
133+
/**
134+
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
135+
* the array passed to all can be a mixture of promise-like objects and other objects.
136+
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
137+
*/
138+
all<T>(promises: Promise<T>[]): Promise<T[]>;
139+
140+
/**
141+
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
142+
*/
143+
race<T>(promises: Promise<T>[]): Promise<T>;
144+
}
145+
146+
declare var Promise: PromiseConstructor;

tns-core-modules/es6.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
interface Symbol {
2+
toString(): string;
3+
valueOf(): Object;
4+
}
5+
6+
interface SymbolConstructor {
7+
prototype: Symbol;
8+
(description?: string | number): symbol;
9+
iterator: symbol;
10+
}
11+
12+
declare var Symbol: SymbolConstructor;

0 commit comments

Comments
 (0)