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:
Pete Bacon Darwin
2020-08-26 12:21:29 +01:00
committed by Andrew Scott
parent 86e11f1110
commit a68f1a78a7
14 changed files with 53 additions and 58 deletions

View File

@ -667,8 +667,8 @@ import {humanizeDom, humanizeDomSourceSpans, humanizeLineColumn} from './ast_spe
it('should set the start and end source spans', () => {
const node = <html.Element>parser.parse('<div>a</div>', 'TestComp').rootNodes[0];
expect(node.startSourceSpan!.start.offset).toEqual(0);
expect(node.startSourceSpan!.end.offset).toEqual(5);
expect(node.startSourceSpan.start.offset).toEqual(0);
expect(node.startSourceSpan.end.offset).toEqual(5);
expect(node.endSourceSpan!.start.offset).toEqual(6);
expect(node.endSourceSpan!.end.offset).toEqual(12);