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

committed by
Victor Berchet

parent
331b9f6425
commit
910c0d9ee7
@ -17,9 +17,9 @@ export class EventListener { constructor(public name: string, public callback: F
|
||||
export class DebugNode {
|
||||
nativeNode: any;
|
||||
listeners: EventListener[];
|
||||
parent: DebugElement;
|
||||
parent: DebugElement|null;
|
||||
|
||||
constructor(nativeNode: any, parent: DebugNode, private _debugContext: DebugContext) {
|
||||
constructor(nativeNode: any, parent: DebugNode|null, private _debugContext: DebugContext) {
|
||||
this.nativeNode = nativeNode;
|
||||
if (parent && parent instanceof DebugElement) {
|
||||
parent.addChild(this);
|
||||
@ -29,19 +29,15 @@ export class DebugNode {
|
||||
this.listeners = [];
|
||||
}
|
||||
|
||||
get injector(): Injector { return this._debugContext ? this._debugContext.injector : null; }
|
||||
get injector(): Injector { return this._debugContext.injector; }
|
||||
|
||||
get componentInstance(): any { return this._debugContext ? this._debugContext.component : null; }
|
||||
get componentInstance(): any { return this._debugContext.component; }
|
||||
|
||||
get context(): any { return this._debugContext ? this._debugContext.context : null; }
|
||||
get context(): any { return this._debugContext.context; }
|
||||
|
||||
get references(): {[key: string]: any} {
|
||||
return this._debugContext ? this._debugContext.references : null;
|
||||
}
|
||||
get references(): {[key: string]: any} { return this._debugContext.references; }
|
||||
|
||||
get providerTokens(): any[] {
|
||||
return this._debugContext ? this._debugContext.providerTokens : null;
|
||||
}
|
||||
get providerTokens(): any[] { return this._debugContext.providerTokens; }
|
||||
|
||||
/**
|
||||
* @deprecated since v4
|
||||
@ -55,9 +51,9 @@ export class DebugNode {
|
||||
export class DebugElement extends DebugNode {
|
||||
name: string;
|
||||
properties: {[key: string]: any};
|
||||
attributes: {[key: string]: string};
|
||||
attributes: {[key: string]: string | null};
|
||||
classes: {[key: string]: boolean};
|
||||
styles: {[key: string]: string};
|
||||
styles: {[key: string]: string | null};
|
||||
childNodes: DebugNode[];
|
||||
nativeElement: any;
|
||||
|
||||
@ -181,8 +177,8 @@ const _nativeNodeToDebugNode = new Map<any, DebugNode>();
|
||||
/**
|
||||
* @experimental
|
||||
*/
|
||||
export function getDebugNode(nativeNode: any): DebugNode {
|
||||
return _nativeNodeToDebugNode.get(nativeNode);
|
||||
export function getDebugNode(nativeNode: any): DebugNode|null {
|
||||
return _nativeNodeToDebugNode.get(nativeNode) || null;
|
||||
}
|
||||
|
||||
export function getAllDebugNodes(): DebugNode[] {
|
||||
@ -203,4 +199,4 @@ export function removeDebugNodeFromIndex(node: DebugNode) {
|
||||
*
|
||||
* @experimental All debugging apis are currently experimental.
|
||||
*/
|
||||
export interface Predicate<T> { (value: T, index?: number, array?: T[]): boolean; }
|
||||
export interface Predicate<T> { (value: T): boolean; }
|
||||
|
Reference in New Issue
Block a user