docs: fix ch 4 so it compiles in strict mode (#40970)
Fixes error: `TS2564: Property 'heroes' has no initializer and is not definitely assigned in the constructor` and makes `hero` property consistent with ch 3 (ref: #40942) PR Close #40970
This commit is contained in:
parent
011a527497
commit
03de2f2b78
|
@ -15,10 +15,10 @@ import { MessageService } from '../message.service';
|
|||
})
|
||||
export class HeroesComponent implements OnInit {
|
||||
|
||||
selectedHero: Hero;
|
||||
selectedHero?: Hero;
|
||||
|
||||
// #docregion heroes
|
||||
heroes: Hero[];
|
||||
heroes: Hero[] = [];
|
||||
// #enddocregion heroes
|
||||
|
||||
constructor(private heroService: HeroService, private messageService: MessageService) { }
|
||||
|
|
Loading…
Reference in New Issue