feat(common): added typed overloaded for AsyncPipe.transform() (#14367)

BREAKING CHANGE: Classes that derive from `AsyncPipe` and override
`transform()` might not compile correctly. Use of  `async` pipe in
templates is unaffected.

Mitigation: Update derived classes of `AsyncPipe` that override
`transform()` to include the type parameter overloads.

Related to #12398

PR Close #14367
This commit is contained in:
Chuck Jazdzewski
2017-01-31 18:11:18 -08:00
committed by Miško Hevery
parent 6b9aa2ca3d
commit 4da7925ad5
2 changed files with 7 additions and 2 deletions

View File

@ -82,6 +82,9 @@ export class AsyncPipe implements OnDestroy, PipeTransform {
}
}
transform<T>(obj: Observable<T>): T|null;
transform<T>(obj: Promise<T>): T|null;
transform<T>(obj: EventEmitter<T>): T|null;
transform(obj: Observable<any>|Promise<any>|EventEmitter<any>): any {
if (!this._obj) {
if (obj) {
@ -93,7 +96,7 @@ export class AsyncPipe implements OnDestroy, PipeTransform {
if (obj !== this._obj) {
this._dispose();
return this.transform(obj);
return this.transform(obj as any);
}
if (this._latestValue === this._latestReturnedValue) {