close

[Fixed] Property ‘…’ has no initializer and is not definitely assigned in the constructor

Today We are Going To Solve Property ‘…’ has no initializer and is not definitely assigned in the constructor in Angular. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.

How to Fix Property ‘…’ has no initializer and is not definitely assigned in the constructor Error?

  1. How to Fix Property ‘…’ has no initializer and is not definitely assigned in the constructor Error?

    To Fix Property ‘…’ has no initializer and is not definitely assigned in the constructor Error just Set “strictPropertyInitialization”. To solve this error you have to just go to the tsconfig.json and set "strictPropertyInitialization": false And your error will be removed. Try this!

  2. Property ‘…’ has no initializer and is not definitely assigned in the constructor

    To Fix Property ‘…’ has no initializer and is not definitely assigned in the constructor Error just Initialize the array. You have to just initialize the array when you declare it just like below makes: any[] = [];

Solution 1 : Set “strictPropertyInitialization”

To solve this error you have to just go to the tsconfig.json and set

"strictPropertyInitialization": false

And your error will be removed. Try this!

Solution 2 : Initialize the array

You have to just initialize the array when you declare it just like below

makes: any[] = [];

Solution 3 : For VScode users

If you are using VSCode and facing this error then you have to just change the TS version that the editor use. and your error will be removed

Conclusion

So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.

Also Read This Solutions

Leave a Comment