█
LastWrite
  • > Curriculum
  • > Pricing
  • > For Educators
  • > About
  • > Contact
Log InGet Started

Questions, concerns, bug reports, or suggestions? We read every message, write to us at [email protected].

More ways to reach us →
LastWrite

Structured computer science lessons for aspiring developers and security professionals.

[email protected]

(201) 785-7951

Mon–Fri, 9 AM–5 PM EST

Learn

  • Curriculum
  • Pricing

Company

  • About
  • For Educators & Schools
  • Contact Us

Legal

  • Terms of Service
  • Privacy Policy
© 2026 LastWrite. All rights reserved.
Curriculum/Programming Languages/TypeScript/TypeScript Setup: tsconfig + strict mode
45 minIntermediate

TypeScript Setup: tsconfig + strict mode

After this lesson, you will be able to: Configure tsconfig.json with strict mode + path aliases; understand each strict flag.

tsconfig.json controls everything. Get strict mode on; understand the trade-offs.

Prerequisites:Why TypeScript

A modern tsconfig.json

Use as a template for new projects.

json
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"lib": ["ES2022"],
"strict": true,
"noUncheckedIndexedAccess": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
"outDir": "./dist",
"rootDir": "./src",
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}

Strict mode breakdown

`strict: true` enables: noImplicitAny, strictNullChecks, strictFunctionTypes, strictBindCallApply, strictPropertyInitialization, noImplicitThis, alwaysStrict, useUnknownInCatchVariables. Most important: strictNullChecks, every value can be null or undefined unless typed otherwise. Catches 95% of real bugs.

Path aliases

`"@/*": ["src/*"]` lets you write `import x from '@/lib/util'` instead of `../../../lib/util`. Bundlers (Vite, Next.js) usually respect tsconfig paths automatically. For node-runtime code, also set up tsconfig-paths or use a bundler. Default for new projects: `@/` for src.

Common mistakes only experienced TS devs avoid

Disabling strict to make code compile. Defeats the point. Setting `noImplicitAny: false`. Lets type errors hide. Forgetting `noUncheckedIndexedAccess`. `array[i]` is typed as T, not T | undefined, misleading. Skipping `verbatimModuleSyntax`. Subtle import/export issues with newer bundlers.

Quick Check

Why enable `noUncheckedIndexedAccess`?

Pick the senior answer.

Sign in and purchase access to unlock this lesson.

Sign in to purchase
←Why TypeScript Exists
Back to TypeScript
Type System Fundamentals→