refactor(compiler): element.startSourceSpan is required (#38581)
Previously, the `startSourceSpan` property could be null but in reality it is always well defined - except for a legacy case in the old i18n extraction/merging code, where the typings for source-spans are already being undermined. Making this property non-null, simplifies code elsewhere in the project. PR Close #38581
This commit is contained in:

committed by
Andrew Scott

parent
86e11f1110
commit
a68f1a78a7
@ -42,7 +42,7 @@ class _Humanizer implements html.Visitor {
|
||||
visitElement(element: html.Element, context: any): any {
|
||||
const res = this._appendContext(element, [html.Element, element.name, this.elDepth++]);
|
||||
if (this.includeSourceSpan) {
|
||||
res.push(element.startSourceSpan?.toString() ?? null);
|
||||
res.push(element.startSourceSpan.toString() ?? null);
|
||||
res.push(element.endSourceSpan?.toString() ?? null);
|
||||
}
|
||||
this.result.push(res);
|
||||
@ -82,7 +82,7 @@ class _Humanizer implements html.Visitor {
|
||||
|
||||
private _appendContext(ast: html.Node, input: any[]): any[] {
|
||||
if (!this.includeSourceSpan) return input;
|
||||
input.push(ast.sourceSpan!.toString());
|
||||
input.push(ast.sourceSpan.toString());
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user