0Pricing
TypeScript Academy · Lesson

Strictness flags

Turn on strictness for safer code: strict, noImplicitAny, exactOptionalPropertyTypes, noUncheckedIndexedAccess.

Intro

Goal: Enable and understand core strictness flags. These options push errors earlier and improve IDE hints.

  • strict
  • noImplicitAny
  • exactOptionalPropertyTypes
  • noUncheckedIndexedAccess

strict + noImplicitAny

strict flips on a bundle of checks; noImplicitAny forbids untyped parameters/vars that default to any.

// tsconfig.json (excerpt)
{
  "compilerOptions": {
    "strict": true,
    "noImplicitAny": true
  }
}

// Effect demo
function sum(a, b) { // Error: implicit any
  return a + b;
}

function sumOk(a: number, b: number): number {
  return a + b;
}

All lessons in this course

  1. Strictness flags
  2. Target, lib, module, JSX settings
  3. Project References (intro)
← Back to TypeScript Academy