npm install -D typescript
Set up a production tsconfig.json for a Node.js ESM API and a library package.
1 { 2 "compilerOptions": { 3 "target": "ES2022", 4 "module": "NodeNext", 5 "moduleResolution": "NodeNext", 6 "lib": ["ES2022"], 7 8 "strict": true, 9 "noUncheckedIndexedAccess": true, 10 "exactOptionalPropertyTypes": true, 11 "noImplicitReturns": true, 12 "noFallthroughCasesInSwitch": true, 13 14 "outDir": "./dist", 15 "rootDir": "./src", 16 "declaration": true, 17 "declarationMap": true, 18 "sourceMap": true, 19 20 "baseUrl": ".", 21 "paths": { 22 "@/*": ["src/*"] 23 }, 24 25 "incremental": true, 26 "skipLibCheck": true 27 }, 28 "include": ["src/**/*"], 29 "exclude": ["node_modules", "dist", "**/*.test.ts"] 30 }
tsc --noEmit succeeds; path aliases resolve; strict catches implicit any
Sign in to share your feedback and join the discussion.