diff --git a/packages/schematics/angular/application/other-files/app.component.spec.ts.template b/packages/schematics/angular/application/other-files/app.component.spec.ts.template index fcdf822fb55b..8eda79d528db 100644 --- a/packages/schematics/angular/application/other-files/app.component.spec.ts.template +++ b/packages/schematics/angular/application/other-files/app.component.spec.ts.template @@ -29,7 +29,7 @@ describe('AppComponent', () => { it('should render title', () => { const fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); - const compiled = fixture.nativeElement; - expect(compiled.querySelector('.content span').textContent).toContain('<%= name %> app is running!'); + const compiled = fixture.nativeElement as HTMLElement; + expect(compiled.querySelector('.content span')?.textContent).toContain('<%= name %> app is running!'); }); });