refactor(router): compatibility with typescript strict flag (#30993)

As part of FW-1265, the `@angular/router` package is made compatible
with the TypeScript `--strict` flag. Read more about the strict flag [here](https://www.typescriptlang.org/docs/handbook/compiler-options.html)

PR Close #30993
This commit is contained in:
Paul Gschwendtner
2019-06-13 21:15:45 +02:00
committed by Miško Hevery
parent 18f0c2f1d4
commit ce9d0de840
4 changed files with 12 additions and 9 deletions

View File

@ -88,11 +88,14 @@ export function waitForMap<A, B>(
}
});
// Closure compiler has problem with using spread operator here. So just using Array.concat.
return of .apply(null, waitHead.concat(waitTail)).pipe(concatAll(), lastValue(), map(() => res));
// Closure compiler has problem with using spread operator here. So we use "Array.concat".
// Note that we also need to cast the new promise because TypeScript cannot infer the type
// when calling the "of" function through "Function.apply"
return (of .apply(null, waitHead.concat(waitTail)) as Observable<Observable<B>>)
.pipe(concatAll(), lastValue(), map(() => res));
}
export function wrapIntoObservable<T>(value: T | NgModuleFactory<T>| Promise<T>| Observable<T>) {
export function wrapIntoObservable<T>(value: T | Promise<T>| Observable<T>): Observable<T> {
if (isObservable(value)) {
return value;
}