fix(core): Update types for TypeScript nullability support (#15472)
This commit is contained in:

committed by
Victor Berchet

parent
331b9f6425
commit
910c0d9ee7
@ -56,7 +56,7 @@ export class CodegenComponentFactoryResolver implements ComponentFactoryResolver
|
||||
resolveComponentFactory<T>(component: {new (...args: any[]): T}): ComponentFactory<T> {
|
||||
let factory = this._factories.get(component) || this._parent.resolveComponentFactory(component);
|
||||
|
||||
return factory ? new ComponentFactoryBoundToModule(factory, this._ngModule) : null;
|
||||
return new ComponentFactoryBoundToModule(factory, this._ngModule);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ export class NgModuleFactory<T> {
|
||||
|
||||
get moduleType(): Type<T> { return this._moduleType; }
|
||||
|
||||
create(parentInjector: Injector): NgModuleRef<T> {
|
||||
create(parentInjector: Injector|null): NgModuleRef<T> {
|
||||
const instance = new this._injectorClass(parentInjector || Injector.NULL);
|
||||
instance.create();
|
||||
return instance;
|
||||
|
@ -63,7 +63,9 @@ export class QueryList<T>/* implements Iterable<T> */ {
|
||||
* See
|
||||
* [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
|
||||
*/
|
||||
find(fn: (item: T, index: number, array: T[]) => boolean): T { return this._results.find(fn); }
|
||||
find(fn: (item: T, index: number, array: T[]) => boolean): T|undefined {
|
||||
return this._results.find(fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* See
|
||||
|
@ -51,7 +51,7 @@ export abstract class ViewContainerRef {
|
||||
/**
|
||||
* Returns the {@link ViewRef} for the View located in this container at the specified index.
|
||||
*/
|
||||
abstract get(index: number): ViewRef;
|
||||
abstract get(index: number): ViewRef|null;
|
||||
|
||||
/**
|
||||
* Returns the number of Views currently attached to this container.
|
||||
@ -120,5 +120,5 @@ export abstract class ViewContainerRef {
|
||||
*
|
||||
* If the `index` param is omitted, the last {@link ViewRef} is detached.
|
||||
*/
|
||||
abstract detach(index?: number): ViewRef;
|
||||
abstract detach(index?: number): ViewRef|null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user