Manuals / TypeScript / Chapter 2
A · Setup · beginner · Week 1 · Chapter 2 of 11
Strict setup & compiler basics
tsconfig.json controls compilation. strict: true enables the checks that matter. tsc type-checks; Vite/esbuild bundle. Understand .ts vs .tsx. JSDoc @ts-check as a bridge from JS.
Path progress11%
Step 1 of 5
Initialize TypeScript
npm install -D typescript. npx tsc --init. Set "strict": true, "module": "ESNext", "moduleResolution": "bundler", "outDir": "dist", "rootDir": "src".
Example
npm install -D typescript
npx tsc --init
// tsconfig.json highlights
{
"compilerOptions": {
"strict": true,
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"noEmit": true,
"skipLibCheck": true
},
"include": ["src"]
}Do this now
Create tsconfig.json in your project. Add "typecheck": "tsc --noEmit" script.
Was this step clear?
Chapter learning outcomes
- tsconfig.json
- strict flags
- tsc vs bundler
- VS Code TS features
- JSDoc @ts-check bridge
Clear these before you leave
Side quest
Strict or bust
Convert utils.js fully to utils.ts with explicit exports typed. Zero implicit any.