Skip to content

Commit 09ec1f4

Browse files
committed
fix(@schematics/angular): remove unsafe any usage in application spec file
The `nativeElement` property on a `TestBed` fixture is of type `any`. In one of the tests within a new application's spec file, the `nativeElement` is accessed but not cast to an appropriate type which results in potentially unsafe member access. The `nativeElement` is now cast as an `HTMLElement` and allows additional usage to be type checked. (cherry picked from commit 5b10d4f)
1 parent 159dc5f commit 09ec1f4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/schematics/angular/application/other-files/app.component.spec.ts.template

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('AppComponent', () => {
2929
it('should render title', () => {
3030
const fixture = TestBed.createComponent(AppComponent);
3131
fixture.detectChanges();
32-
const compiled = fixture.nativeElement;
33-
expect(compiled.querySelector('.content span').textContent).toContain('<%= name %> app is running!');
32+
const compiled = fixture.nativeElement as HTMLElement;
33+
expect(compiled.querySelector('.content span')?.textContent).toContain('<%= name %> app is running!');
3434
});
3535
});

0 commit comments

Comments
 (0)