From 3a227a1f6fb9d734aeba83cdf80246ae775a4f53 Mon Sep 17 00:00:00 2001 From: Chuck Jazdzewski Date: Wed, 2 Aug 2017 17:32:02 -0700 Subject: [PATCH] refactor(router): compile router cleanly with TypeScript 2.4 (#18465) --- packages/router/src/router.ts | 2 +- packages/router/src/utils/collection.ts | 2 +- packages/router/test/config.spec.ts | 2 +- packages/router/test/integration.spec.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index bf24f9c410..f9635c2e5b 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -533,7 +533,7 @@ export class Router { let resolve: any = null; let reject: any = null; - const promise = new Promise((res, rej) => { + const promise = new Promise((res, rej) => { resolve = res; reject = rej; }); diff --git a/packages/router/src/utils/collection.ts b/packages/router/src/utils/collection.ts index a256f2b64f..a72560ae9b 100644 --- a/packages/router/src/utils/collection.ts +++ b/packages/router/src/utils/collection.ts @@ -116,5 +116,5 @@ export function wrapIntoObservable(value: T | NgModuleFactory| Promise| return fromPromise(Promise.resolve(value)); } - return of (value); + return of (value as T); } diff --git a/packages/router/test/config.spec.ts b/packages/router/test/config.spec.ts index ad643a8fae..9ef3037c69 100644 --- a/packages/router/test/config.spec.ts +++ b/packages/router/test/config.spec.ts @@ -45,7 +45,7 @@ describe('config', () => { expect(() => { validateConfig([ {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`); }); diff --git a/packages/router/test/integration.spec.ts b/packages/router/test/integration.spec.ts index ebccb7bf9f..5c42074f5e 100644 --- a/packages/router/test/integration.spec.ts +++ b/packages/router/test/integration.spec.ts @@ -1820,7 +1820,7 @@ describe('Integration', () => { function delayPromise(delay: number): Promise { let resolve: (val: boolean) => void; - const promise = new Promise(res => resolve = res); + const promise = new Promise(res => resolve = res); setTimeout(() => resolve(true), delay); return promise; }