'I'm new to Angular, I'm trying to figure out where I'm wrong
I keep getting this error and I'm not sure what to do?[1] [1]: https://i.stack.imgur.com/mQ3Xo.png
Solution 1:[1]
you should type the array
private cartItems = [] as Product[];
per typescript eslint default rules https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-as-const.md
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |