How to stop 'was declared but never used' error detector

Hello guys,

As you guys aware, now we get ‘was declared but never used’ error when something is declared but not used in a project.
I think this error didn’t exist in previous version of angular… but the problem is this error detects working code as a problem when the code is not immediately in use.

Is there any way to deactivate this error detection? I don’t think this error detector has any significant role in my current project.


do you have an example, I don’t get what you mean

to answer your question, I didn’t try, but there is maybe a tsconfig.json to set to ignore these warnings?

1 Like


"noUnusedLocals": true,
"noUnusedParameters": true,



I’m troubled with this topic.

But this is not really an error at all. Without that code, search feature will not run.
So I see the error detector is not helping in this case.

Thanks, I will check the tsconfig.json file!

No worries, let us know if it works

But otherwise I would say, I a variable is declared but never use and that you double check the code and notice that you don’t it then, just delete it :wink:

1 Like

Thanks a lot!

I changed this configuration in tsconfig.json from true to false:

"noUnusedParameters": false,

and now typescript stopped throwing “was declared but never used” error.

In my current project, these unused parameters are necessary and even if they’re errors, they’re not supposed to stop the whole app from starting.