0Pricing
TypeScript Academy · Lesson

Readonly, Exclude, Extract, NonNullable

Apply more utility types for immutability and filtering.

Welcome

TypeScript's standard library includes several utility types beyond Partial, Required, Pick, and Omit. This lesson covers Readonly, Exclude, Extract, and NonNullable.

Readonly<T>

Makes all properties of T readonly. Prevents any property reassignment after creation.
interface Config { host: string; port: number; }
const cfg: Readonly<Config> = { host: 'localhost', port: 3000 };
// cfg.host = 'remote'; // Error!

All lessons in this course

  1. Partial and Required: Toggling Optionality
  2. Pick and Omit: Selecting Properties
  3. Record: Mapping Keys to Value Types
  4. Readonly, Exclude, Extract, NonNullable
← Back to TypeScript Academy