Skip to main content
Programming Languages

TypeScript Tutorial with Examples.

TypeScript tutorial with examples: static typing for JavaScript, from annotations and interfaces to generics, utility types and advanced type patterns.

Beginner

Start here — no prior experience needed

6 lessons

Intermediate

For developers with core concepts down

12 lessons
typescript intermediate
5 min read

The type keyword: unions, intersections, discriminated unions, mapped, conditional, template literal and recursive types — with real tsc and tsx output.

typescript intermediate
5 min read

Access modifiers, private vs #private, parameter properties, getters, abstract classes, statics and implements — shown with real tsc errors and tsx output.

typescript intermediate
5 min read

Generic functions, classes, constraints, defaults, distributive conditional types and infer — each shown with real tsc errors and tsx output.

typescript intermediate
5 min read

Partial, Required, Readonly, Pick, Omit, Record, Exclude, NonNullable, ReturnType, Parameters and Awaited, each shown with real tsc errors and tsx output.

typescript intermediate
5 min read

ES modules under nodenext, import type, barrels, .d.ts files for untyped JS, @types, globals, path aliases and project references, with real output.

typescript intermediate
5 min read

unknown catch variables, type guards, assertion functions, Result types, exhaustive checks and custom errors with cause — with real tsc and tsx output.

typescript intermediate
5 min read

Promises, a typed fetch wrapper, unknown errors, Promise.all/allSettled/race, AbortSignal, async generators and a concurrency queue — with real output.

typescript intermediate
5 min read

Test TypeScript with Vitest: typed fixtures, vi.mock and vi.mocked, spies, fake timers, expectTypeOf type tests, and Jest with ts-jest — with real runs.

typescript intermediate
5 min read

Singleton, Factory, a typed registry, a type-state Builder, Strategy and Observer in TypeScript, each run with real tsc errors and tsx output.

typescript intermediate
5 min read

Type React 19 props, children, hooks, events, context and generic components, verified with real tsc errors and server-rendered output from tsx.

typescript intermediate
5 min read

Build a typed Express 5 API: tsconfig for Node, validated env config, typed routes and middleware, async errors and Zod validation, with real curl output.

typescript intermediate
5 min read

30 TypeScript interview questions on types, generics, narrowing, utility, conditional and mapped types, each answered with real tsc and tsx output.

Advanced

Production-grade patterns for experienced engineers

3 lessons

Also part of TypeScript

Taught in other topics. Each link opens the lesson in its home topic.

2 lessons