Production TypeScript
Narrowing, Generics, Advanced Type Programming & Tooling
7 modules, 35 lessons: The Compiler And Mental Model; Primitives, Literals And Top/Bottom Types; Object Shapes, Interfaces And Types; Type Narrowing And Control Flow; Generics And Parameterized Types; Advanced Type Programming And Utilities; Modules, Tooling And The OpenAPI Spine.
Intermediate · 2 hours · 35 lessons · 40 labs
Who it is for
Intermediate level.
For JavaScript developers who want to write TypeScript that catches mistakes before they reach users, on the frontend or the backend.
What you don't need yet:
- No TypeScript experience: you start with how the compiler works
- You don't need to know React or Node.js yet
- Nothing to install: runnable labs open in an online sandbox
What helps:
- Working JavaScript: functions, objects, promises and modules
Before you start:
- Working JavaScript: functions, objects, promises and modules
Take next:
- Frontend Architecture & Web Platform — Intermediate
- React 19 & Modern Component Architecture — Intermediate
- Node.js Internals & Backend Services — Advanced
Learning paths:
Nobody needs to know everything before they start. Each course builds on the one before, so a learning path takes you there step by step.
Labs
40 labs, 33 of them graded: you write the code, it runs, and graded labs check the result. The outline lists each lesson's labs.
What is free
Start free: First module free with an account. Pro: Every course, lab, handbook, practice exam and certificate.
- Pro monthly — $29 a month. Every course, lab, handbook, practice exam and certificate
- Pro yearly — $249 a year. Every course, lab, handbook, practice exam and certificate
Course outline
The Compiler And Mental Model
- Why TypeScript: Contracts, Erased Types And Soundness (2 labs): You can explain how TypeScript acts as a compile-time static type system, why types vanish at runtime through erasure, and how structural typing differs from nominal typing.
- The Compiler Pipeline: tsc, AST And Code Emission (2 labs): You can describe the four phases of the TypeScript compiler pipeline from source text to AST to type checking and emission, and configure noEmitOnError.
- tsconfig.json: target, lib, strict And NodeNext (1 lab): You can author a production tsconfig.json configured with strict mode, modern module resolution, and correct library declarations.
- Type Annotations, Type Inference And Contextual Typing (2 labs): You can distinguish between explicit type annotations and type inference, leverage contextual typing in higher-order functions, and avoid redundant type annotations.
- Verify Your Environment: Running tsc And Bun TypeScript (1 lab): You can verify your TypeScript compiler installation, run TypeScript files directly with Bun or Node, and validate your development environment.
Primitives, Literals And Top/Bottom Types
- Primitive Types: String, Number, Boolean, Bigint And Symbol (1 lab): You can declare and manipulate primitive types in TypeScript and avoid the wrapper object anti-pattern.
- Literal Types: String, Number, Boolean Literals And const (2 labs): You can employ literal types to represent exact domain values like HTTP methods and status codes, and use const assertions to prevent type widening in configuration dictionaries.
- any Versus unknown: Defensive Typing In Practice (1 lab): You can distinguish between any and unknown, eliminate any-leakage from your applications, and safely parse untrusted external data using unknown with runtime type narrowing.
- void, undefined And null: Exact Optional Property Types (1 lab): You can correctly differentiate between void, undefined, and null in API schemas, and leverage exactOptionalPropertyTypes to separate omitted keys from explicit undefined values.
- never: The Bottom Type And Exhaustive Switch Checking (2 labs): You can describe the mathematical role of never as the bottom type, implement the assertNever pattern for exhaustive switch statements, and catch unhandled union variants at compile time.
Object Shapes, Interfaces And Types
- Type Aliases Versus Interfaces: Declaration Merging (1 lab): You can evaluate the architectural tradeoffs between interfaces and type aliases, and employ declaration merging to extend third-party application contracts.
- Optional Properties, Readonly And Index Signatures (1 lab): You can protect entity state with readonly modifiers, model dynamic dictionaries using index signatures, and handle dictionary lookups safely.
- Union Types, Intersections And Property Conflicts (1 lab): You can compose complex data models using union and intersection types, avoid property conflicts that collapse to never, and access common properties safely.
- Discriminated Unions: Tagged Variants And Pattern Matching (1 lab): You can design discriminated unions to make illegal states unrepresentable in frontend and backend workflows, and pattern match cleanly on discriminant tags.
- Tuples: Fixed Length, Labeled Elements And Variadic Tuples (1 lab): You can declare fixed-length positional data with tuples, document intent using labeled tuple elements, and manipulate dynamic argument lists with variadic tuples.
Type Narrowing And Control Flow
- Typeof Guards, Truthiness And Equality Narrowing (1 lab): You can leverage control flow analysis to narrow union types using typeof type guards, truthiness checks, and literal equality comparisons.
- The in Operator And Instanceof Narrowing (1 lab): You can narrow heterogeneous object shapes using the in operator and distinguish class hierarchies at runtime using instanceof.
- Custom Type Predicates: Functions Returning is Type (1 lab): You can author custom type predicate functions returning parameter is Type to encapsulate validation logic and narrow arrays without unsafe type assertions.
- Assertion Signatures: asserts condition And Invariants (1 lab): You can implement assertion functions using asserts condition syntax to validate runtime invariants and narrow scopes without introducing nested conditional branches.
- Exhaustive Narrowing With never In Production Handlers (1 lab): You can synthesize all narrowing techniques to build bulletproof domain event dispatchers with guaranteed compile-time exhaustiveness.
Generics And Parameterized Types
- Why Generics: Functions, Identities And Type Variables (1 lab): You can author generic functions and parameterized types that capture and propagate concrete types while eliminating type duplication.
- Generic Interfaces, Classes And Type Aliases (1 lab): You can design generic interfaces, type aliases, and classes to build reusable data access repositories and stateful containers.
- Generic Constraints: extends, keyof And Indexed Access (1 lab): You can apply generic constraints and indexed access types to build type-safe property accessors and record transformations.
- Default Generic Arguments And Multi-Type Parameters (1 lab): You can design multi-parameter generics with sensible defaults to build flexible API client wrappers and response envelopes.
- Const Type Parameters: Retaining Literal Types In Functions (1 lab): You can apply const type parameters to preserve exact literal types and readonly tuple structures without requiring caller-side const assertions.
Advanced Type Programming And Utilities
- Core Utilities: Partial, Required, Readonly, Pick And Omit (1 lab): You can transform domain models into specialized creation, patch, and read DTOs using Partial, Required, Readonly, Pick, and Omit.
- Union Utilities: Exclude, Extract, NonNullable And Awaited (1 lab): You can manipulate union types and unpack promise resolutions using Exclude, Extract, NonNullable, and Awaited.
- Function Utilities: ReturnType, Parameters And Constructor (1 lab): You can extract function parameters and return types to author type-safe middleware interceptors and metrics wrappers.
- Conditional Types: Ternary Types And Type Inference With infer (1 lab): You can write conditional types with infer to extract embedded type variables and perform branch logic in the type system.
- Mapped Types, Key Remapping With as And Template Literals (1 lab): You can combine mapped types, key remapping with as, and template literal types to generate strongly typed event listeners and accessors.
Modules, Tooling And The OpenAPI Spine
- ECMAScript Modules, CJS Interop And verbatimModuleSyntax (1 lab): You can configure ECMAScript modules, apply type-only imports, and enforce verbatimModuleSyntax for predictable code emission.
- Declaration Files, Ambient Namespaces And Module Augmentation (1 lab): You can author declaration files, ambient namespaces, and module augmentations to extend third-party types and global scopes.
- The satisfies Operator: Safe Validation Without Widening (1 lab): You can apply the satisfies operator to validate complex configuration objects against contracts without widening property types.
- Modern Decorators: Stage 3 Standards And Class Metadata (1 lab): You can write standard Stage 3 method and class decorators using ClassMethodDecoratorContext to intercept execution and manage metadata.
- The Spine Artifact: Generating Typed Models From OpenAPI (1 lab): You can derive and consume strongly typed models and API client SDKs from OpenAPI specifications to anchor full-stack applications.