Skip to content

TypeScript checklist

Copy this list into a pull request, design review or project kickoff and tick what applies. Rules are grouped by level and sorted by score (criteria). Each links to the file that explains it and cites its sources. Automatable names tools that can check the rule in CI (see the file's "How to enforce" section).

Also apply the general checklist.

This file is generated by python3 scripts/rank.py fix from the guidelines. Don't edit it by hand.

  • TS-1 (8) Keep strict on in every project, and don't turn off the checks it includes. (specific/typescript) Automatable: tsc.
  • TS-2 (7) When another tool compiles your TypeScript, turn on isolatedModules, add erasableSyntaxOnly if that tool only strips types, and type-check with tsc --noEmit in CI. (specific/typescript) Automatable: tsc.
  • TS-5 (7) Set module for the host that loads your code: nodenext when Node.js runs it, and esnext or preserve with moduleResolution: bundler when a bundler does. (specific/typescript)
  • TS-6 (7) Turn on verbatimModuleSyntax, and import and export types with import type and export type. (specific/typescript) Automatable: tsc.
  • TS-7 (7) Don't use any. Use unknown for values whose type you don't know, and narrow them with type guards before you use them. (specific/typescript) Automatable: typescript-eslint no-explicit-any.
  • TS-8 (7) Type data from outside the program, such as JSON.parse results, fetch responses, storage and messages, as unknown, and check it at runtime before you narrow it to your own types. Don't claim its shape with an as assertion. (specific/typescript) Automatable: typescript-eslint no-explicit-any.
  • TS-3 (6) In new projects, also turn on noUncheckedIndexedAccess and exactOptionalPropertyTypes. (specific/typescript) Automatable: tsc.
  • TS-4 (6) Remove the options that TypeScript 6.0 deprecated, such as baseUrl, moduleResolution: node10, target: es5 and AMD or UMD output, instead of silencing the warnings with ignoreDeprecations. (specific/typescript) Automatable: tsc.
  • TS-9 (6) Model a value that can be in one of several states as a discriminated union, and make switch statements over it exhaustive with a never check. (specific/typescript) Automatable: typescript-eslint switch-exhaustiveness-check.
  • TS-10 (6) Check a library with the settings its consumers might use: module set to node18 or nodenext rather than moduleResolution: bundler, declaration on, and the lowest target you support. (specific/typescript) Automatable: arethetypeswrong CLI.
  • TS-11 (6) Publish declaration files with the package and point to them from exports: put the types condition first in each entry, and give the ES module and CommonJS entry points separate declaration files. (specific/typescript) Automatable: arethetypeswrong CLI, publint rules.
  • TS-12 (6) Give each environment, such as browser, server, worker and tests, its own tsconfig.json, and connect them, and the packages of a monorepo, with project references built by tsc --build. (specific/typescript)

Conditional (1–5)

  • TS-13 (4) Turn on isolatedDeclarations only when declaration emit limits your build, as in large monorepos, or when another tool generates your declaration files. (specific/typescript)