// LEARN · LANGUAGES & FRAMEWORKS
TypeScript
A practical TypeScript course from a first compiler error to generics, type-level programming, declaration files and large projects. Every example is compiled and checked against TypeScript 7.0.
Level: Beginner to advanced · For: Developers who know some JavaScript and want the compiler to catch their mistakes, from a first type to a typed codebase.
Syllabus
Beginner
Complete
After this level you can
- Install TypeScript 7.0, run tsc on a project with a tsconfig.json, and read a compiler error to fix the code
- Annotate variables, functions and object shapes, and explain when inference makes an annotation unnecessary
- Model alternatives with union and literal types and narrow them safely, including exhaustiveness checks with never
- Type functions with optional, default and rest parameters, overloads and function type expressions
- Describe object data with optional and readonly properties, index signatures, intersections and tuples
B1Setup and the basics5 of 5 written · 5 lessonsRuns on your computer
Install TypeScript, write a first tsconfig.json and fix a first compiler error
You build: Type-checking an existing JavaScript script
B2Everyday types5 of 5 written · 5 lessonsRuns in your browser
Annotate everyday values and objects, and know when inference is enough
You build: A typed contact book
B3Narrowing5 of 5 written · 5 lessonsRuns in your browser
Handle each member of a union safely, with discriminated unions and exhaustiveness checks
You build: An order-status state machine
B4More on functions5 of 5 written · 5 lessonsRuns in your browser
Type any function signature, including overloads and this
You build: A typed utility library
B5Object types5 of 5 written · 5 lessonsRuns in your browser
Describe real data shapes with readonly properties, index signatures, intersections and tuples
You build: A typed inventory loader
Beginner project
Typed expense splitter
A strict TypeScript program that splits expenses between people, models payment states as a discriminated union and fails to compile when a state is not handled.
Runs in your browserSelf-checked against a rubric
Open the project guideIntermediate
Coming soon
After this level you can
- Write generic functions, interfaces and classes with constraints and defaults
- Derive types from other types with keyof, typeof, indexed access, conditional, mapped and template literal types
- Type classes with visibility modifiers, implements, abstract members and generic this
- Configure a multi-file project with module, moduleResolution and verbatimModuleSyntax, and explain ESM and CommonJS interop
- Apply the built-in utility types and explain structural type compatibility
I1GenericsComing soon · 5 lessonsRuns in your browser
Write reusable, type-safe code with generic functions, interfaces and classes
You build: A typed cache
- I1.1Coming soon
- I1.2Coming soon
- I1.3Coming soon
- I1.4Coming soon
- I1.5Coming soon
I2Types from typesComing soon · 6 lessonsRuns in your browser
Derive types instead of repeating them, with keyof, conditional, mapped and template literal types
You build: A typed event emitter
- I2.1Coming soon
- I2.2Coming soon
- I2.3Coming soon
- I2.4Coming soon
- I2.5Coming soon
- I2.6Coming soon
I3ClassesComing soon · 5 lessonsRuns in your browser
Type object-oriented code with modifiers, implements and abstract classes
You build: A typed shape hierarchy
- I3.1Coming soon
- I3.2Coming soon
- I3.3Coming soon
- I3.4Coming soon
- I3.5Coming soon
I4Modules and project configurationComing soon · 5 lessonsRuns on your computer
Configure a real multi-file project, choosing between nodenext and bundler
You build: A multi-file command-line tool compiled with tsc
- I4.1Coming soon
- I4.2Coming soon
- I4.3Coming soon
- I4.4Coming soon
- I4.5Coming soon
I5Utility types and compatibilityComing soon · 5 lessonsRuns in your browser
Use the built-in utility types and explain structural typing
You build: A typed API client
- I5.1Coming soon
- I5.2Coming soon
- I5.3Coming soon
- I5.4Coming soon
- I5.5Coming soon
Intermediate project
Typed CLI task manager
A multi-file ES module project with generic repository classes, a JSON file store, a typed command parser, typed errors and no any.
Runs on your computerSelf-checked against a rubric
Advanced
Coming soon
After this level you can
- Write and publish declaration files, and augment third-party types
- Add types to an existing JavaScript codebase with checkJs and JSDoc, then migrate it file by file
- Use distributive and recursive conditional types, satisfies, const type parameters and variance annotations
- Structure a large codebase with project references and tsc -b, and migrate a 6.x configuration to 7.0
- Validate untrusted input at runtime boundaries, and run TypeScript in Node.js with type stripping
A1Declaration filesComing soon · 5 lessonsRuns on your computer
Type code you did not write, with .d.ts files and module augmentation
You build: Types for an untyped library
- A1.1Coming soon
- A1.2Coming soon
- A1.3Coming soon
- A1.4Coming soon
- A1.5Coming soon
A2Typing and migrating JavaScriptComing soon · 5 lessonsRuns on your computer
Add types to an existing JavaScript codebase and tighten strictness step by step
You build: Migrating a small JavaScript project
- A2.1Coming soon
- A2.2Coming soon
- A2.3Coming soon
- A2.4Coming soon
- A2.5Coming soon
A3Advanced type-level programmingComing soon · 5 lessonsRuns in your browser
Express precise APIs in the type system
You build: Typed URL-route parameters
- A3.1Coming soon
- A3.2Coming soon
- A3.3Coming soon
- A3.4Coming soon
- A3.5Coming soon
A4Decorators, symbols and iterationComing soon · 5 lessonsRuns in your browser
Type decorators, symbols, iterators, generators and mixins
You build: Logging and timing decorators
- A4.1Coming soon
- A4.2Coming soon
- A4.3Coming soon
- A4.4Coming soon
- A4.5Coming soon
A5Projects at scale and 7.0Coming soon · 5 lessonsRuns on your computer
Build and maintain large codebases with project references, and migrate to 7.0
You build: A three-package workspace
- A5.1Coming soon
- A5.2Coming soon
- A5.3Coming soon
- A5.4Coming soon
- A5.5Coming soon
A6Runtime boundaries and publishingComing soon · 5 lessonsRuns on your computer
Keep types honest at the edges and publish a typed package
You build: A validated config loader
- A6.1Coming soon
- A6.2Coming soon
- A6.3Coming soon
- A6.4Coming soon
- A6.5Coming soon
Advanced project
Typed HTTP client library
A small package with a typed route map, runtime validation of responses, generated declaration files and project references.
Runs on your computerSelf-checked against a rubric
Capstone
Capstone
Migrate a JavaScript app to strict TypeScript
Migrate a provided JavaScript app in stages, from JSDoc and checkJs to strict TypeScript 7.0, keeping its tests green and writing a migration log.
Runs on your computerSelf-checked against a rubric
Sources
- Announcing TypeScript 7.0 (TypeScript blog)
- The Basics (The TypeScript Handbook)
- What is a tsconfig.json (TypeScript documentation)
- TypeScript 6.0 release notes (TypeScript documentation)
- Modules: TypeScript (Node.js v24 documentation)
- How to set up TypeScript (TypeScript download page)
- npm install (npm Docs)
- TSConfig Reference (TypeScript documentation)
- TSConfig option: pretty (TypeScript documentation)
- Migrating from JavaScript (TypeScript documentation)
- TSConfig option: noImplicitAny (TypeScript documentation)
- TypeScript Handbook: Everyday Types
- More on Functions: unknown (The TypeScript Handbook)
- TypeScript 3.0 release notes: the unknown type (TypeScript documentation)
- Type Inference (TypeScript documentation)
- Object Types (The TypeScript Handbook)
- TypeScript 3.4 release notes: const assertions (TypeScript documentation)
- Narrowing: typeof type guards, Using type predicates (The TypeScript Handbook)
- TypeScript 3.7 release notes: never-returning functions (TypeScript documentation)
- TypeScript 4.9 release notes: checks on the in operator (TypeScript documentation)
- TSConfig reference: useUnknownInCatchVariables (TypeScript documentation)
- TypeScript 5.5 release notes: inferred type predicates (TypeScript documentation)
- TypeScript 3.2 release notes: non-unit types as union discriminants (TypeScript documentation)
- TypeScript 4.4 release notes: aliased conditions and discriminants (TypeScript documentation)
- TypeScript 4.6 release notes: destructured discriminated unions (TypeScript documentation)
- TypeScript 3.9 release notes: // @ts-expect-error comments (TypeScript documentation)
- Type Compatibility: Comparing two functions (TypeScript documentation)
- Assert: assert.throws (Node.js v24 documentation)
- Test runner (Node.js v24 documentation)
- TSConfig reference: exactOptionalPropertyTypes (TypeScript documentation)
- TSConfig reference: noUncheckedIndexedAccess (TypeScript documentation)
- Utility Types: Record<Keys, Type> (The TypeScript Handbook)