Skip to content

Advanced TypeScript

Staff-engineer-level type system mastery. Recursive types, variance, template literal types, declaration files, module augmentation, and TypeScript performance in large projects.

1
Infer and Type Extraction
advanced

The infer keyword for pattern-matching type structures, extracting return types, parameter types, promise results, and building advanced type utilities that decompose any type.

11 min read
2
Recursive and Self-Referential Types
advanced

Tree types, JSON types, DeepPartial, DeepReadonly, and the depth limits that prevent infinite recursion. How to model recursive data structures in TypeScript's type system.

13 min read
3
Template Literal Types
advanced

String manipulation at the type level — route typing, CSS unit types, event name generation, and the intrinsic string types that let TypeScript parse and transform strings during compilation.

13 min read
4
Variance, Covariance, and Contravariance
advanced

The in/out modifiers, why function parameters are contravariant, why return types are covariant, and the variance rules that prevent unsound type assignments.

13 min read
5
The satisfies Operator
advanced

Type checking without type widening — how satisfies differs from type annotations and as casts, when to use each, and the patterns it unlocks for configuration objects and theme types.

12 min read
6
Declaration Files and Ambient Types
advanced

How .d.ts files work, the declare keyword, global augmentation, DefinitelyTyped, and writing type declarations for untyped JavaScript libraries.

12 min read
7
Module Augmentation and Declaration Merging
advanced

Extending third-party types without forking, interface merging rules, module augmentation patterns, and the techniques library authors use to make their types extensible.

12 min read
8
Project References and Incremental Builds
advanced

Composite projects, build mode, monorepo TypeScript setup, and the configuration that turns 60-second builds into 2-second incremental rebuilds.

13 min read
9
TypeScript Performance at Scale
advanced

Type instantiation limits, avoiding slow types, tracing compilation bottlenecks, and the patterns that keep large codebases compiling in seconds.

13 min read
10
Quiz: Type or Error? (Advanced)
advanced

10 advanced TypeScript brain-teasers covering infer, template literals, variance, recursive types, and satisfies. Staff-engineer-level type system challenges.

9 min read