Skip to article content
FrontendXLearning path

TypeScript Mastery

Go from the first annotated variable to writing your own conditional, mapped and infer-based utility types, while keeping a clear line between compile-time checking and runtime behavior.

beginner · 40 lessons · 132 exercises · about 1815 minutes

  • Predict
  • Explain
  • Implement
  • Debug
  • Test
  • Interview

What you will be able to do

#
  • Explain what TypeScript erases at compile time and what still runs at runtime.
  • Narrow union types safely with typeof, truthiness, equality, in and custom type guards.
  • Model objects and functions with interfaces, type aliases, overloads and optional or readonly members.
  • Write generic functions and constraints that infer their arguments instead of begging for annotations.
  • Use and then reimplement built-in utility types such as Partial, Pick, Omit and Record.
  • Build conditional, mapped, keyof and template literal types, including infer and key remapping.
  • Prove type-level behavior with compile-time assertions instead of runtime logging.
  • Model tuples, readonly arrays and const assertions to control literal widening.
  • Choose between enums, const objects and union literal types for runtime-safe constants.
  • Implement interfaces with classes and reason about structural compatibility.
  • Author declaration files and module augmentation for untyped or extendable libraries.
  • Separate type-only imports and keep modules compatible with isolatedModules.
  • Reason about variance and write sound branded and recursive types.
  • Type React components, hooks, async flows, builders and API clients with reusable patterns.

Prerequisites

#

Lessons

#
  1. Compile-time types, runtime values

    beginner · 35 minutes · 4 exercises

    Describe how TypeScript annotations are erased before execution.

  2. Inference, annotations and the unknown family

    beginner · 40 minutes · 4 exercises

    Predict when TypeScript infers a literal type and when it widens.

  3. Union types and narrowing

    beginner · 45 minutes · 4 exercises

    Read a union type and describe the values it allows.

  4. Objects, interfaces and structural typing

    beginner · 40 minutes · 4 exercises

    Choose between an interface and a type alias with a reason.

  5. Type guards and discriminated unions

    intermediate · 45 minutes · 4 exercises

    Write a custom type guard with a `value is T` return type.

  6. Functions, overloads and this

    intermediate · 45 minutes · 4 exercises

    Type function values, optional, default and rest parameters.

  7. Generics and constraints

    intermediate · 45 minutes · 4 exercises

    Write a generic function that infers its type argument.

  8. Built-in utility types

    intermediate · 40 minutes · 4 exercises

    Apply Partial, Required, Readonly, Pick, Omit and Record.

  9. keyof, indexed access and satisfies

    advanced · 45 minutes · 4 exercises

    Use keyof and typeof to derive key unions.

  10. Conditional types and infer

    advanced · 50 minutes · 4 exercises

    Write a conditional type with extends.

  11. Mapped and template literal types

    advanced · 50 minutes · 4 exercises

    Write a mapped type over keyof T.

  12. Capstone: build utility types from scratch

    advanced · 60 minutes · 4 exercises

    Reimplement Pick, Omit and DeepPartial using mapped and conditional types.

  13. Tuples, readonly arrays and const assertions

    intermediate · 45 minutes · 3 exercises

    Read a tuple type and describe its fixed length and per-position types.

  14. Enums and const object alternatives

    intermediate · 40 minutes · 3 exercises

    Declare numeric and string enums and read their emitted JavaScript.

  15. Classes, implements and access modifiers

    intermediate · 45 minutes · 3 exercises

    Type class fields, constructors and methods, including parameter properties.

  16. Declaration files and ambient types

    intermediate · 45 minutes · 3 exercises

    Write a .d.ts that describes a JavaScript module.

  17. Module augmentation and declaration merging

    advanced · 45 minutes · 3 exercises

    Merge an interface across declarations.

  18. Type-only imports and exports

    intermediate · 40 minutes · 3 exercises

    Use import type and export type to mark erased imports.

  19. isolatedModules and safe single-file transpilation

    intermediate · 40 minutes · 3 exercises

    Explain what isolatedModules requires and why bundlers need it.

  20. Assignability and variance

    advanced · 50 minutes · 3 exercises

    Explain covariance, contravariance and invariance in plain terms.

  21. Migrating to strict mode

    advanced · 45 minutes · 3 exercises

    List what the strict family enables.

  22. Branded and nominal types

    advanced · 45 minutes · 3 exercises

    Create a brand with a phantom property or intersection.

  23. Recursive and deep types

    advanced · 50 minutes · 3 exercises

    Write a recursive conditional type with a base case.

  24. Parsing strings with template literal types

    advanced · 50 minutes · 3 exercises

    Split a string type with infer and a template literal.

  25. Type-checking performance

    advanced · 45 minutes · 3 exercises

    Identify type constructs that slow the checker.

  26. Assertion functions and asserts

    advanced · 45 minutes · 3 exercises

    Write an assertion function with an asserts return type.

  27. const type parameters and readonly inference

    advanced · 45 minutes · 3 exercises

    Use a const type parameter to infer literal types.

  28. The Result pattern and typed errors

    advanced · 45 minutes · 3 exercises

    Model success and failure as a discriminated union.

  29. Typing async code and promises

    advanced · 45 minutes · 3 exercises

    Type async functions and awaited values.

  30. Factory functions and generic construction

    advanced · 45 minutes · 3 exercises

    Write a factory that infers its product type.

  31. Typing the builder pattern

    advanced · 45 minutes · 3 exercises

    Build an object step by step with a chainable API.

  32. Typing React props and children

    intermediate · 45 minutes · 3 exercises

    Type a component props object, including children.

  33. Typing hooks and generic hooks

    intermediate · 45 minutes · 3 exercises

    Type useState, useRef and useReducer.

  34. A typed API client

    advanced · 50 minutes · 3 exercises

    Type request and response shapes.

  35. Type-level challenge set

    advanced · 55 minutes · 3 exercises

    Solve small type puzzles with conditional, mapped and template types.

  36. Typed error handling

    advanced · 45 minutes · 3 exercises

    Narrow an unknown catch value safely.

  37. Module resolution and package types

    intermediate · 45 minutes · 3 exercises

    Explain node16, bundler and classic resolution.

  38. Decorators and metadata

    advanced · 45 minutes · 3 exercises

    Distinguish legacy and standard decorators.

  39. Migrating JavaScript to TypeScript

    intermediate · 45 minutes · 3 exercises

    Enable allowJs and checkJs and read the errors.

  40. Iterables, generators and async iterators

    advanced · 45 minutes · 3 exercises

    Type Iterable, Iterator and Generator.

© 2026 FrontendX. All rights reserved.