TypeScript Foundations·Types that pay for themselves

A strict project you can trust

Configure the compiler so it catches bugs instead of adding ceremony.

Intermediate 12 min read Lesson 10 of 300 Challenge included
What you will be able to do
  • Start with strict: true and fix errors instead of weakening the setting.
  • Use noEmit for type checking and let your bundler handle output.
  • Separate application code from tests and build output with include and exclude.

In plain English

TypeScript only helps as much as your configuration allows. Strict mode, noUncheckedIndexedAccess and consistent module settings remove whole categories of runtime surprises. Run type checking in CI, not only in your editor.

tsconfig.jsonJSON
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "strict": true,
    "noUncheckedIndexedAccess": true,
    "noEmit": true,
    "skipLibCheck": true
  },
  "include": ["src"]
}
Your turn

Make the config strict

Easy

Add strict and noUncheckedIndexedAccess to a tsconfig. Explain which new error you would expect in a function that reads items[0].

JSON · starter
{
  "compilerOptions": {}
}
Check your understanding before moving on.
Knowledge checkQuestion 1

What does noEmit do?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Lesson 10 of 300 · 0% of course