build: fix our copy of Array#find typing (#27742)

It should be nullable, matching the lib.es2015.d.ts from TypeScript

PR Close #27742
This commit is contained in:
Alex Eagle
2018-12-18 16:06:25 -08:00
committed by Matias Niemelä
parent a20b2f72f2
commit e8f7241366
6 changed files with 28 additions and 28 deletions

View File

@ -412,7 +412,7 @@ function declareTests(config?: {useJit: boolean}) {
const ngIfEl = fixture.debugElement.children[0];
const someViewport: SomeViewport =
ngIfEl.childNodes
.find(debugElement => debugElement.nativeNode.nodeType === Node.COMMENT_NODE)
.find(debugElement => debugElement.nativeNode.nodeType === Node.COMMENT_NODE)!
.injector.get(SomeViewport);
expect(someViewport.container.length).toBe(2);
expect(ngIfEl.children.length).toBe(2);
@ -812,7 +812,7 @@ function declareTests(config?: {useJit: boolean}) {
})
.createComponent(MyComp);
const tc = fixture.debugElement.childNodes.find(
debugElement => debugElement.nativeNode.nodeType === Node.COMMENT_NODE);
debugElement => debugElement.nativeNode.nodeType === Node.COMMENT_NODE)!;
const emitter = tc.injector.get(DirectiveEmittingEvent);
const myComp = fixture.debugElement.injector.get(MyComp);

View File

@ -315,7 +315,7 @@ describe('discovery utils', () => {
it('should work on templates', () => {
const templateComment = Array.from(fixture.hostElement.childNodes)
.find((node: ChildNode) => node.nodeType === Node.COMMENT_NODE);
.find((node: ChildNode) => node.nodeType === Node.COMMENT_NODE)!;
const lContext = loadLContext(templateComment);
expect(lContext).toBeDefined();
expect(lContext.native as any).toBe(templateComment);
@ -323,7 +323,7 @@ describe('discovery utils', () => {
it('should work on ICU expressions', () => {
const icuComment = Array.from(fixture.hostElement.querySelector('i18n') !.childNodes)
.find((node: ChildNode) => node.nodeType === Node.COMMENT_NODE);
.find((node: ChildNode) => node.nodeType === Node.COMMENT_NODE)!;
const lContext = loadLContext(icuComment);
expect(lContext).toBeDefined();
expect(lContext.native as any).toBe(icuComment);
@ -333,7 +333,7 @@ describe('discovery utils', () => {
const ngContainerComment = Array.from(fixture.hostElement.childNodes)
.find(
(node: ChildNode) => node.nodeType === Node.COMMENT_NODE &&
node.textContent === `ng-container`);
node.textContent === `ng-container`)!;
const lContext = loadLContext(ngContainerComment);
expect(lContext).toBeDefined();
expect(lContext.native as any).toBe(ngContainerComment);