Reputation: 2687
I was working on a project last year, it was using Angular 8. I resumed the project this year, I now am using Angular 13 to make the project more actual. I was stunned by the amount of errors it threw. Many of the code I used on the ngOnInit I had to change to the contructor, mainly property initialization highlighting FormGroup now I have to initialize it in the constructor otherwise I get a message saying that it was not initialized in the constructor. I cannot use the sysntax someObject["property"] because the string property may not be a property of someObject. I got a lot of other erros related to syntax. What happened since Angular 8. I am not "Javascript developer". I am not inside what is going on.
I am positive that want to use Angular 13 but. 5 versions is huge gap I am not complained. Is it true that since Angular 8 there were changes on syntax rule?
Upvotes: 0
Views: 2903
Reputation: 17818
Seems like during some update, Angular's strict mode was activated. The compiler then requires a more strict syntax. You can get rid of those errors by setting "strict": false
in tsconfig.json
.
But the Angular team recommends to use strict mode for the following reasons:
Strict mode improves maintainability and helps you catch bugs ahead of time. Additionally, strict mode applications are easier to statically analyze and can help the ng update command refactor code more safely and precisely when you are updating to future versions of Angular.
Upvotes: 1
Reputation: 5482
I am positive that want to use Angular 13 but. 5 versions is huge gap I am not complained. Is it true that since Angular 8 there were changes on syntax rule?
Short answer: Yes.
Given the large amount of major updates you have to go through, I suggest to use the official update guide. It allows you to go through required changes step by step and tackle them one by one as they occur. I directly linked the guide from 8.0 to 13.0, however, I suggest you do this in smaller steps (8.0 -> 9.0; 9.0 -> 10.0 and so on). This will dramatically help you to see exactly what (obvious) changes you need to adjust your code for.
If you want an ever deeper dive you can read up on the official changelogs.
Upvotes: 0