refactor(router): compile router cleanly with TypeScript 2.4 (#18465)
This commit is contained in:
parent
81cb5bc3a7
commit
3a227a1f6f
@ -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;
|
||||||
});
|
});
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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`);
|
||||||
});
|
});
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user