From 03de2f2b7868ac3156d161cfa0f43ca4d27c20c5 Mon Sep 17 00:00:00 2001 From: Carl Fredrik Samson Date: Tue, 23 Feb 2021 20:27:02 +0100 Subject: [PATCH] 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 --- .../examples/toh-pt4/src/app/heroes/heroes.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aio/content/examples/toh-pt4/src/app/heroes/heroes.component.ts b/aio/content/examples/toh-pt4/src/app/heroes/heroes.component.ts index 020cd6c8e4..bd29c51058 100644 --- a/aio/content/examples/toh-pt4/src/app/heroes/heroes.component.ts +++ b/aio/content/examples/toh-pt4/src/app/heroes/heroes.component.ts @@ -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) { }