Chapter 1 of 7 · 6 practices · 6 min · 4-question quiz
Compiler settings and TypeScript 7
The tsconfig decides how much TypeScript checks for you. This chapter covers the strict flags, module settings for your runtime and the move to the native TypeScript 7 compiler.
Start: Keep strict on and add the checks strict leaves out6 practices in this chapter
- 1Keep strict on and add the checks strict leaves outSince TypeScript 6.0,
strictdefaults totrue, and TypeScript 7.0 keeps that default.strictturns on a family of nine checks, includingstrictNullChecks,noImplicitAny… - 2Choose module and moduleResolution for the runtime that runs your codeModule settings tell TypeScript how imports are resolved at runtime. If they do not match reality, the compiler accepts imports that fail when the code runs, or rejects imports that would work.
- 3Set types and rootDir explicitlyTypeScript 6.0 changed two defaults that surprise people on upgrade, and TypeScript 7.0 keeps them:
typesnow defaults to[]. Global type packages under@types, such as@types/nodeor a test… - 4Write erasable TypeScript and mark type-only importsMore tools now run TypeScript by removing the types rather than compiling them. Node.js strips types by default since v22.18.0 and v23.6.0, and the feature is stable from v24.12.0 and v25.2.0. Type…
- 5Move to TypeScript 7 by clearing the 6.0 deprecations firstTypeScript 7.0 is the compiler ported to Go. The TypeScript team reports typical full builds 8 to 12 times faster than 6.0 on large projects, lower peak memory in every project they measured, and the…
- 6Run the type checker in CI, separate from the buildMany fast tools, including Node's type stripping, esbuild, SWC and most bundlers, remove types without checking them. A project can build and run while full of type errors. The only thing that checks…
Check yourself on this chapter
4 questions, right here once you are signed in. Your progress is saved as you read.