This error means you are trying to set a variable like:

itemLength: number = 0;

The problem TypeScript has here, is that when you set this to 0, TypeScript already assumes this is a number. Therefore it is not needed.


No need to set the annotation, just remove it:

itemLength = 0;


Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!