§ series — interactive course
TypeScript, beginner to advanced
An interactive TypeScript course in eight phases: from your first type annotation to type-level programming and interview prep. Predict the type, spot the error, try it in the playground.
8 phases · 32 lessons · about 13 hours
0 of 32 lessons done
Start: Why TypeScript: the compiler and tsconfig →Phase 1
BeginnerFoundations
The compiler, basic types, functions and object types.
- 1.1Why TypeScript: the compiler and tsconfig What TypeScript adds to JavaScript, what the compiler actually does, and the handful of tsconfig options that matter on day one.15 min
- 1.2Primitives, arrays, tuples and the special types The building blocks of every TypeScript type: the seven primitives, arrays and tuples, any vs unknown vs never vs void, object vs {} vs Object, and why `as` is a loaded gun.20 min
- 1.3Typing functions Parameters, return types, optional and rest parameters, function types, overloads, the `this` parameter, and the `void` and `never` return types that trip people up in interviews.20 min
- 1.4Object types: type aliases vs interfaces How to describe the shape of objects: object type literals, `type` vs `interface`, optional and readonly properties, index signatures and a first look at `Record`.20 min
Phase 2
BeginnerType system core
Unions, narrowing, discriminated unions and structural typing.
- 2.1Unions and literal types Say a value is one of several types, or one of a few exact values. Learn how literal types widen, how `as const` stops it, and why you can only use shared members of a union.18 min
- 2.2Narrowing How TypeScript follows your `if` checks to refine a union into one specific type: typeof, truthiness, equality, `in`, instanceof, assignment, and the cases where narrowing is lost.20 min
- 2.3Discriminated unions Model data that comes in several shapes with a shared tag field, switch on it safely, and get a compile error whenever you forget a case.18 min
- 2.4Structural typing and intersections TypeScript compares types by shape, not by name. Learn what that means for assignability, why excess property checks only fire on fresh object literals, how intersections combine types, and when functions are assignable.18 min
Phase 3
IntermediateClasses, enums and modules
Classes, enums versus as const, modules and declaration files.
- 3.1Classes How TypeScript types JavaScript classes: fields, access modifiers vs #private, readonly, abstract classes, implements, override, polymorphic this, and why classes are still compared structurally.25 min
- 3.2Enums vs as const Numeric, string and const enums, why enums aren't erasable syntax, and the as-const object and string-union patterns most teams now prefer.20 min
- 3.3Modules and declaration files How TypeScript handles ES modules, type-only imports, verbatimModuleSyntax and isolatedModules, module resolution, .d.ts files, declare, ambient modules, declare global, namespaces and triple-slash references.25 min
Phase 4
IntermediateGenerics
Type parameters, constraints, patterns and type guards.
- 4.1Generics: the basics Why generics beat `any` and overloads, how to write generic functions, interfaces and classes, and how TypeScript infers type arguments at the call site.20 min
- 4.2Generic constraints and defaults Limit what a type parameter can be with `extends`, type-safe property access with `keyof`, default type arguments, and the famous 'could be instantiated with a different subtype' error explained.20 min
- 4.3Generic patterns you'll actually use Typed results, repositories, event emitters, factories, groupBy/pluck helpers and builders: the generic patterns that show up in real codebases and take-home tests.25 min
- 4.4Type guards, assertions and satisfies Teach the compiler what you know with type predicates and assertion functions, understand exactly what `as` and `!` do (and don't), and pick between annotation, `as` and `satisfies`.25 min
Phase 5
AdvancedType-level programming
keyof, mapped, conditional and template literal types.
- 5.1keyof, typeof and indexed access The three operators that let you derive types from other types and from real values, so a constant array or config object becomes the single source of truth.20 min
- 5.2Mapped types Loop over keys at the type level to transform one object type into another: rebuild Partial, Readonly, Pick and Record, change modifiers, and rename or filter keys with `as`.25 min
- 5.3Conditional types and infer If/else at the type level: `T extends U ? X : Y`, pulling types out of other types with `infer`, rebuilding ReturnType, Parameters and Awaited, and writing recursive types without hitting the depth limit.25 min
- 5.4Distributive conditional types Why a conditional type applied to a union runs once per member, how that builds Exclude and Extract, how to switch it off with `[T]`, and the `never`, `boolean` and UnionToIntersection puzzles interviewers love.25 min
- 5.5Template literal types String manipulation at the type level: build string unions from other unions, change case with the intrinsic helpers, parse strings with `infer`, and derive getter names, event names and route params from a single string.25 min
Phase 6
AdvancedUtility types in practice
Built-in utilities, building your own, typing data and async code.
- 6.1The built-in utility types Partial, Pick, Omit, Record, ReturnType, Awaited, NoInfer and the rest: what each one does, the gotchas interviewers ask about, and how to pick the right one.25 min
- 6.2Build the utility types yourself Re-implement Partial, Pick, Omit, Exclude, ReturnType, Awaited and friends from scratch, then go further with DeepReadonly, DeepPartial and Mutable.30 min
- 6.3Typing data at the boundary Why JSON.parse returns any, how unknown and hand-written type guards keep untrusted data honest, and how to infer a TypeScript type from a tiny runtime schema.25 min
- 6.4Async code and errors Typing promises and async functions, Promise.all and friends as tuples, unknown catch variables, custom Error classes, a Result type, and generic retry and timeout helpers.25 min
Phase 7
AdvancedAdvanced and tooling
Variance, nominal typing, modern features and the compiler.
- 7.1Variance Covariance, contravariance, bivariance and invariance: why a Dog[] is an Animal[], why a handler of Dogs is not a handler of Animals, and where TypeScript deliberately lets unsound code through.20 min
- 7.2Branded types and declaration merging Simulate nominal types with brands and smart constructors, then learn how TypeScript merges declarations: interfaces, namespaces, module augmentation and declare global.20 min
- 7.3Modern TypeScript features The features from TypeScript 4.9 to 5.8 that interviewers ask about: const type parameters, satisfies, standard decorators, accessor, using, NoInfer, inferred type predicates and erasableSyntaxOnly.25 min
- 7.4The compiler and tsconfig in depth Every flag in the strict family and what it catches, the extra safety flags worth turning on, module resolution, isolated transpilation, declaration output, project references and how to diagnose a slow build.25 min
Phase 8
InterviewInterview prep
Rapid-fire questions, type challenges, gotchas and a mock interview.
- 8.160 rapid-fire interview questions Sixty short TypeScript interview questions in six topic decks, with answers phrased the way you would say them out loud, plus spot-checks between decks.35 min
- 8.2Type challenges, easy to hard Twelve type-level puzzles in rising difficulty, from First and Length to UnionToIntersection and IsUnion, each with tests and a proven solution.60 min
- 8.3Gotchas and live coding Fifteen classic TypeScript gotchas that interviewers love, then three live-coding exercises (debounce, pick, typed path get) with hints, solutions and how to talk through them.45 min
- 8.4Mock interview A 25-question timed mock interview across the whole language, a self-scoring guide that points you to what to review, and four open-ended questions with model answers.40 min