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.
Recommended (6–8)¶
-
TS-1(8) Keepstricton 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 onisolatedModules, adderasableSyntaxOnlyif that tool only strips types, and type-check withtsc --noEmitin CI. (specific/typescript) Automatable: tsc. -
TS-5(7) Setmodulefor the host that loads your code:nodenextwhen Node.js runs it, andesnextorpreservewithmoduleResolution: bundlerwhen a bundler does. (specific/typescript) -
TS-6(7) Turn onverbatimModuleSyntax, and import and export types withimport typeandexport type. (specific/typescript) Automatable: tsc. -
TS-7(7) Don't useany. Useunknownfor values whose type you don't know, and narrow them with type guards before you use them. (specific/typescript) Automatable: typescript-eslintno-explicit-any. -
TS-8(7) Type data from outside the program, such asJSON.parseresults,fetchresponses, storage and messages, asunknown, and check it at runtime before you narrow it to your own types. Don't claim its shape with anasassertion. (specific/typescript) Automatable: typescript-eslintno-explicit-any. -
TS-3(6) In new projects, also turn onnoUncheckedIndexedAccessandexactOptionalPropertyTypes. (specific/typescript) Automatable: tsc. -
TS-4(6) Remove the options that TypeScript 6.0 deprecated, such asbaseUrl,moduleResolution: node10,target: es5and AMD or UMD output, instead of silencing the warnings withignoreDeprecations. (specific/typescript) Automatable: tsc. -
TS-9(6) Model a value that can be in one of several states as a discriminated union, and makeswitchstatements over it exhaustive with anevercheck. (specific/typescript) Automatable: typescript-eslintswitch-exhaustiveness-check. -
TS-10(6) Check a library with the settings its consumers might use:moduleset tonode18ornodenextrather thanmoduleResolution: bundler,declarationon, and the lowesttargetyou support. (specific/typescript) Automatable: arethetypeswrong CLI. -
TS-11(6) Publish declaration files with the package and point to them fromexports: put thetypescondition 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 owntsconfig.json, and connect them, and the packages of a monorepo, with project references built bytsc --build. (specific/typescript)
Conditional (1–5)¶
-
TS-13(4) Turn onisolatedDeclarationsonly when declaration emit limits your build, as in large monorepos, or when another tool generates your declaration files. (specific/typescript)