Closed pokerclan closed 6 years ago
Hello there and thank you for purchasing the book.
Are you using TypeScript 2.7 by any chance? That build introduced the strictPropertyInitialization
flag (set to true
by default) which could cause these kind of errors.
If you're using TS 2.7, try to turn it off by adding a "strictPropertyInitialization": false
setting to the compilerOptions
object in your tsconfig.json
file: if that doesn't fix it, try to temporarily downgrade to TS 2.6 and see if the error persists.
I also made a post on my blog explaining the issue and enumerating some possible workarounds/fixes.
References
With code from the repository I can reproduce the error on any chapter. The four lines starting at @Input are the lines with the errors.
Visual Studio Community 2017
export class QuizListComponent implements OnInit {
Severity Code Description Project File Line Suppression State Error TS2564 (TS) Property 'class' has no initializer and is not definitely assigned in the constructor. TestMakerFreeWebApp_Chapter_02 (tsconfig project) C:\Users\JWPok\source\repos\Core2angular5\ASP.NET-Core-2-and-Angular-5-master\TestMakerFreeWebApp_Chapter_02\ClientApp\app\components\quiz\quiz-list.component.ts 23 Active
Error TS2564 (TS) Property 'quizzes' has no initializer and is not definitely assigned in the constructor. TestMakerFreeWebApp_Chapter_02 (tsconfig project) C:\Users\JWPok\source\repos\Core2angular5\ASP.NET-Core-2-and-Angular-5-master\TestMakerFreeWebApp_Chapter_02\ClientApp\app\components\quiz\quiz-list.component.ts 29 Active
Error TS2564 (TS) Property 'selectedQuiz' has no initializer and is not definitely assigned in the constructor. TestMakerFreeWebApp_Chapter_02 (tsconfig project) C:\Users\JWPok\source\repos\Core2angular5\ASP.NET-Core-2-and-Angular-5-master\TestMakerFreeWebApp_Chapter_02\ClientApp\app\components\quiz\quiz-list.component.ts 27 Active
Error TS2564 (TS) Property 'title' has no initializer and is not definitely assigned in the constructor. TestMakerFreeWebApp_Chapter_02 (tsconfig project) C:\Users\JWPok\source\repos\Core2angular5\ASP.NET-Core-2-and-Angular-5-master\TestMakerFreeWebApp_Chapter_02\ClientApp\app\components\quiz\quiz-list.component.ts 25 Active