Search code examples
typescriptlintunused-variables

How to detect unused variables in Typescript?


Is there a way to detect unused variables in Typescript (something like ESLint in Javascript)?


Solution

  • As of version 2.0, Typescript has built-in support for detecting unused local variables and parameters. The compiler flags are as follows:

    --noUnusedLocals                    Report Errors on Unused Locals.
    --noUnusedParameters                Report Errors on Unused Parameters.