refactor(ivy): fix type of factory functions to allow explicit types (#30855)

Factory functions written by the compiler optionally allow an explicit type
to be passed. If called with this type, an instance of the given type will
be created instead of the type for which the factory was generated. This is
used to power inheritance of Angular types, as if the constructor of a class
is inherited from its superclass, then the factory function of the
superclass must be used (it has all the DI info) to construct an instance of
the derived class.

This commit adjusts typings in a few places to allow factory functions to be
called with this extra type parameter.

PR Close #30855
This commit is contained in:
Alex Rickabaugh
2019-06-04 13:50:48 -07:00
committed by Andrew Kushnir
parent b2937b16c3
commit 0ee09cdd7e
7 changed files with 9 additions and 9 deletions

View File

@ -837,7 +837,7 @@ export declare function ɵɵenableBindings(): void;
export declare function ɵɵgetCurrentView(): OpaqueViewState;
export declare function ɵɵgetFactoryOf<T>(type: Type<any>): ((type: Type<T> | null) => T) | null;
export declare function ɵɵgetFactoryOf<T>(type: Type<any>): FactoryFn<T> | null;
export declare function ɵɵgetInheritedFactory<T>(type: Type<any>): (type: Type<T>) => T;
@ -868,7 +868,7 @@ export declare function ɵɵinject<T>(token: Type<T> | InjectionToken<T>): T;
export declare function ɵɵinject<T>(token: Type<T> | InjectionToken<T>, flags?: InjectFlags): T | null;
export interface ɵɵInjectableDef<T> {
factory: () => T;
factory: (t?: Type<any>) => T;
providedIn: InjectorType<any> | 'root' | 'any' | null;
token: unknown;
value: T | undefined;