refactor(docs-infra): fix docs examples for tslint rule no-angle-bracket-type-assertion (#38143)

This commit updates the docs examples to be compatible with the
`no-angle-bracket-type-assertion` tslint rule.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
This commit is contained in:
George Kalpakas
2020-07-30 13:03:15 +03:00
committed by Alex Rickabaugh
parent 8aa29438ac
commit 3c7359f026
9 changed files with 13 additions and 13 deletions

View File

@ -256,7 +256,7 @@ describe('demo (with TestBed):', () => {
fixture.detectChanges();
const comp = fixture.componentInstance;
const input = <HTMLInputElement> fixture.debugElement.query(By.css('input')).nativeElement;
const input = fixture.debugElement.query(By.css('input')).nativeElement as HTMLInputElement;
expect(comp.name).toBe(expectedOrigName,
`At start name should be ${expectedOrigName} `);
@ -294,7 +294,7 @@ describe('demo (with TestBed):', () => {
fixture.detectChanges();
const comp = fixture.componentInstance;
const input = <HTMLInputElement> fixture.debugElement.query(By.css('input')).nativeElement;
const input = fixture.debugElement.query(By.css('input')).nativeElement as HTMLInputElement;
expect(comp.name).toBe(expectedOrigName,
`At start name should be ${expectedOrigName} `);

View File

@ -21,7 +21,7 @@ describe('HeroDetailComponent - no TestBed', () => {
hds.getHero.and.returnValue(asyncData(expectedHero));
hds.saveHero.and.returnValue(asyncData(expectedHero));
comp = new HeroDetailComponent(hds, <any> activatedRoute, router);
comp = new HeroDetailComponent(hds, activatedRoute as any, router);
comp.ngOnInit();
// OnInit calls HDS.getHero; wait for it to get the fake hero

View File

@ -358,7 +358,7 @@ class Page {
constructor(fixture: ComponentFixture<HeroDetailComponent>) {
// get the navigate spy from the injected router spy object
const routerSpy = <any> fixture.debugElement.injector.get(Router);
const routerSpy = someFixture.debugElement.injector.get(Router) as any;
this.navigateSpy = routerSpy.navigate;
// spy on component's `gotoList()` method

View File

@ -17,7 +17,7 @@ describe ('HeroesService (with spies)', () => {
beforeEach(() => {
// TODO: spy on other methods too
httpClientSpy = jasmine.createSpyObj('HttpClient', ['get']);
heroService = new HeroService(<any> httpClientSpy);
heroService = new HeroService(httpClientSpy as any);
});
it('should return expected heroes (HttpClient called once)', () => {