Typescript Configuration

Published:
Last Modified:

There are a lot of options to tweak typescript behavior.
These are the options that I have found very useful.

The below config is for node js projects.

{
  "compilerOptions": {
    "declaration": true,
    "declarationMap": true,
    "esModuleInterop": true,
    "module": "nodeNext",
    "noImplicitReturns": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedParameters": true,
    "noUnusedLocals": true,
    "strict": true,
    "verbatimModuleSyntax": true
  }
}

Refer tsconfig for more details.

For target, refer below github repo for suggested bases for each node js version.
https://github.com/tsconfig/bases/tree/main/bases