fix(language-service): Update types for TypeScript nullability support
This commit is contained in:
@ -111,7 +111,7 @@ class _Visitor implements html.Visitor {
|
||||
this._translations = translations;
|
||||
|
||||
// Construct a single fake root element
|
||||
const wrapper = new html.Element('wrapper', [], nodes, undefined, undefined, undefined);
|
||||
const wrapper = new html.Element('wrapper', [], nodes, undefined !, undefined, undefined);
|
||||
|
||||
const translatedNode = wrapper.visit(this, null);
|
||||
|
||||
|
@ -9,12 +9,12 @@
|
||||
import {ParseSourceSpan} from '../parse_util';
|
||||
|
||||
export interface Node {
|
||||
sourceSpan: ParseSourceSpan|null;
|
||||
sourceSpan: ParseSourceSpan;
|
||||
visit(visitor: Visitor, context: any): any;
|
||||
}
|
||||
|
||||
export class Text implements Node {
|
||||
constructor(public value: string, public sourceSpan: ParseSourceSpan|null) {}
|
||||
constructor(public value: string, public sourceSpan: ParseSourceSpan) {}
|
||||
visit(visitor: Visitor, context: any): any { return visitor.visitText(this, context); }
|
||||
}
|
||||
|
||||
@ -43,8 +43,7 @@ export class Attribute implements Node {
|
||||
export class Element implements Node {
|
||||
constructor(
|
||||
public name: string, public attrs: Attribute[], public children: Node[],
|
||||
public sourceSpan: ParseSourceSpan|null = null,
|
||||
public startSourceSpan: ParseSourceSpan|null = null,
|
||||
public sourceSpan: ParseSourceSpan, public startSourceSpan: ParseSourceSpan|null = null,
|
||||
public endSourceSpan: ParseSourceSpan|null = null) {}
|
||||
visit(visitor: Visitor, context: any): any { return visitor.visitElement(this, context); }
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ export interface TemplateAst {
|
||||
/**
|
||||
* The source span from which this node was parsed.
|
||||
*/
|
||||
sourceSpan: ParseSourceSpan|null;
|
||||
sourceSpan: ParseSourceSpan;
|
||||
|
||||
/**
|
||||
* Visit this node and possibly transform it.
|
||||
@ -127,7 +127,7 @@ export class ElementAst implements TemplateAst {
|
||||
public directives: DirectiveAst[], public providers: ProviderAst[],
|
||||
public hasViewContainer: boolean, public queryMatches: QueryMatch[],
|
||||
public children: TemplateAst[], public ngContentIndex: number|null,
|
||||
public sourceSpan: ParseSourceSpan|null, public endSourceSpan: ParseSourceSpan|null) {}
|
||||
public sourceSpan: ParseSourceSpan, public endSourceSpan: ParseSourceSpan|null) {}
|
||||
|
||||
visit(visitor: TemplateAstVisitor, context: any): any {
|
||||
return visitor.visitElement(this, context);
|
||||
|
@ -391,7 +391,7 @@ class TemplateParseVisitor implements html.Visitor {
|
||||
nodeName, attrs, elementProps, events, references,
|
||||
providerContext.transformedDirectiveAsts, providerContext.transformProviders,
|
||||
providerContext.transformedHasViewContainer, providerContext.queryMatches, children,
|
||||
hasInlineTemplates ? null : ngContentIndex, element.sourceSpan || null,
|
||||
hasInlineTemplates ? null : ngContentIndex, element.sourceSpan,
|
||||
element.endSourceSpan || null);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user