UNV

Use @tsconfig/strictest for tsconfig.json

Published on

Fully utilizing TypeScript features for strict coding contributes to building a reliable system.

I recommend using the strictest.json found in the tsconfig/bases.

The content of the strictest.json is below:

{
  "compilerOptions": {
    "strict": true,
    "allowUnusedLabels": false,
    "allowUnreachableCode": false,
    "exactOptionalPropertyTypes": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitOverride": true,
    "noImplicitReturns": true,
    "noPropertyAccessFromIndexSignature": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,

    "isolatedModules": true,

    "checkJs": true,

    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "Strictest",
  "_version": "2.0.0"
}

You can use that by running the following command (see README.md):

npm install --save-dev @tsconfig/strictest

And add your tsconfig.json:

{
  "extends": "@tsconfig/strictest/tsconfig.json"
}

Setting up tsconfig.json appropriately should be done before using linters such as typescript-eslint or biome. By enforcing stricter rules for coding in TypeScript, we elevate the standard level of safety consciousness within the team.