refactor(router): compile router cleanly with TypeScript 2.4 (#18465)

This commit is contained in:
Chuck Jazdzewski 2017-08-02 17:32:02 -07:00 committed by Victor Berchet
parent 81cb5bc3a7
commit 3a227a1f6f
4 changed files with 4 additions and 4 deletions

View File

@ -533,7 +533,7 @@ export class Router {
let resolve: any = null; let resolve: any = null;
let reject: any = null; let reject: any = null;
const promise = new Promise((res, rej) => { const promise = new Promise<boolean>((res, rej) => {
resolve = res; resolve = res;
reject = rej; reject = rej;
}); });

View File

@ -116,5 +116,5 @@ export function wrapIntoObservable<T>(value: T | NgModuleFactory<T>| Promise<T>|
return fromPromise(Promise.resolve(value)); return fromPromise(Promise.resolve(value));
} }
return of (value); return of (value as T);
} }

View File

@ -45,7 +45,7 @@ describe('config', () => {
expect(() => { expect(() => {
validateConfig([ validateConfig([
{path: 'a', component: ComponentA}, {path: 'a', component: ComponentA},
[{path: 'b', component: ComponentB}, {path: 'c', component: ComponentC}] [{path: 'b', component: ComponentB}, {path: 'c', component: ComponentC}] as any
]); ]);
}).toThrowError(`Invalid configuration of route '': Array cannot be specified`); }).toThrowError(`Invalid configuration of route '': Array cannot be specified`);
}); });

View File

@ -1820,7 +1820,7 @@ describe('Integration', () => {
function delayPromise(delay: number): Promise<boolean> { function delayPromise(delay: number): Promise<boolean> {
let resolve: (val: boolean) => void; let resolve: (val: boolean) => void;
const promise = new Promise(res => resolve = res); const promise = new Promise<boolean>(res => resolve = res);
setTimeout(() => resolve(true), delay); setTimeout(() => resolve(true), delay);
return promise; return promise;
} }