Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8529662

Browse files
committedOct 12, 2017
Upgrade to typescript 2.5.2
Due to stricter generic type checks, signatures for ZoneAwarePromise need to be changed. See microsoft/TypeScript#16368 The signatures from lib.es5.d.ts were copied over for .then and .catch.
1 parent 326a07f commit 8529662

File tree

4 files changed

+3223
-2859
lines changed

4 files changed

+3223
-2859
lines changed
 

‎lib/common/promise.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ Zone.__load_patch('ZoneAwarePromise', (global: any, Zone: ZoneType, api: _ZonePr
207207
}
208208
}
209209

210-
function scheduleResolveOrReject<R, U>(
210+
function scheduleResolveOrReject<R, U1, U2>(
211211
promise: ZoneAwarePromise<any>, zone: AmbientZone, chainPromise: ZoneAwarePromise<any>,
212-
onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): void {
212+
onFulfilled?: (value: R) => U1, onRejected?: (error: any) => U2): void {
213213
clearRejectedNoCatch(promise);
214214
const delegate = (promise as any)[symbolState] ?
215215
(typeof onFulfilled === FUNCTION) ? onFulfilled : forwardResolution :
@@ -265,7 +265,7 @@ Zone.__load_patch('ZoneAwarePromise', (global: any, Zone: ZoneType, api: _ZonePr
265265
static all<R>(values: any): Promise<R> {
266266
let resolve: (v: any) => void;
267267
let reject: (v: any) => void;
268-
let promise = new this((res, rej) => {
268+
let promise = new this<R>((res, rej) => {
269269
resolve = res;
270270
reject = rej;
271271
});
@@ -306,10 +306,12 @@ Zone.__load_patch('ZoneAwarePromise', (global: any, Zone: ZoneType, api: _ZonePr
306306
}
307307
}
308308

309-
then<R, U>(
310-
onFulfilled?: (value: R) => U | PromiseLike<U>,
311-
onRejected?: (error: any) => U | PromiseLike<U>): Promise<R> {
312-
const chainPromise: Promise<R> = new (this.constructor as typeof ZoneAwarePromise)(null);
309+
then<TResult1 = R, TResult2 = never>(
310+
onFulfilled?: ((value: R) => TResult1 | PromiseLike<TResult1>)|undefined|null,
311+
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>)|undefined|
312+
null): Promise<TResult1|TResult2> {
313+
const chainPromise: Promise<TResult1|TResult2> =
314+
new (this.constructor as typeof ZoneAwarePromise)(null);
313315
const zone = Zone.current;
314316
if ((this as any)[symbolState] == UNRESOLVED) {
315317
(<any[]>(this as any)[symbolValue]).push(zone, chainPromise, onFulfilled, onRejected);
@@ -319,7 +321,8 @@ Zone.__load_patch('ZoneAwarePromise', (global: any, Zone: ZoneType, api: _ZonePr
319321
return chainPromise;
320322
}
321323

322-
catch<U>(onRejected?: (error: any) => U | PromiseLike<U>): Promise<R> {
324+
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>)|undefined|
325+
null): Promise<R|TResult> {
323326
return this.then(null, onRejected);
324327
}
325328
}

‎package-lock.json

+3,209-2,850
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"ts-loader": "^0.6.0",
9494
"tslint": "^4.1.1",
9595
"tslint-eslint-rules": "^3.1.0",
96-
"typescript": "2.3.4",
96+
"typescript": "2.5.2",
9797
"vrsource-tslint-rules": "^4.0.0",
9898
"webdriver-manager": "^12.0.6",
9999
"webdriverio": "^4.8.0",

‎tsconfig.json

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"declaration": false,
1212
"noEmitOnError": false,
1313
"stripInternal": false,
14+
// TODO: turn this on.
15+
"strict": false,
1416
"lib": ["es5", "dom", "es2015.promise"]
1517
},
1618
"exclude": [

0 commit comments

Comments
 (0)
This repository has been archived.