TypeScript 7 cheatsheet
TypeScript 7: tsconfig options
6 common TypeScript 7 tasks.
A solid starting tsconfig
A strict configuration for a Node.js project using ES modules.
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"strict": true,
"skipLibCheck": true,
"outDir": "dist"
},
"include": ["src"]
}
Turn on strict mode
Enable the family of strict type-checking options. Recommended for new code.
"strict": true
Treat indexed access as possibly undefined
Make array and object index access include undefined, catching missing-item bugs.
"noUncheckedIndexedAccess": true
Set up import aliases
Map an alias such as @/utils to a folder. Your bundler needs the same alias.
"baseUrl": ".",
"paths": { "@/*": ["src/*"] }
Skip checking declaration files
Speed up type-checking by not checking .d.ts files from libraries.
"skipLibCheck": true
Keep imports as written
Make import type and export type explicit, which suits type stripping and bundlers.
"verbatimModuleSyntax": true