TypeScript from Zero
Learn TypeScript from zero, no JavaScript needed: Node.js and TypeScript setup, variables, numbers, strings, types, and a typed task tracker project.
Part 1
TypeScript from Zero: Setup and Your First Program
Install Node.js and TypeScript, run your first program with node, and see why tsc catches mistakes before they run.
Part 2
TypeScript from Zero: Variables with let and const
let for values that change, const for values that stay, and how TypeScript remembers each variable's type.
Part 3
TypeScript from Zero: Numbers and Math
Operators, the Math helpers, the 0.1 + 0.2 surprise and NaN in TypeScript, plus a typo caught by tsc.
Part 4
TypeScript from Zero: Strings
Quotes, string helpers, template literals and the 5 + 3 trap in TypeScript, caught by tsc.
Part 5
TypeScript Booleans and Comparisons: === vs ==
TypeScript from Zero, episode 5: TypeScript Booleans and Comparisons: === vs ==. Full code and real outputs, step by step.
Part 6
TypeScript if, else and switch: Decisions for Beginners
TypeScript from Zero, episode 6: TypeScript if, else and switch: Decisions for Beginners. Full code and real outputs, step by step.
Part 7
TypeScript Loops: for, while and for...of (and How to Stop an Infinite Loop)
TypeScript from Zero, episode 7: TypeScript Loops: for, while and for...of (and How to Stop an Infinite Loop). Full code and real outputs, step by step.
Part 8
TypeScript Arrays: Index, push, pop and length
TypeScript from Zero, episode 8: TypeScript Arrays: Index, push, pop and length. Full code and real outputs, step by step.
Part 9
TypeScript Objects: Properties, Dot vs Brackets (and a Missing Property Error)
TypeScript from Zero, episode 9: TypeScript Objects: Properties, Dot vs Brackets (and a Missing Property Error). Full code and real outputs, step by step.
Part 10
TypeScript Functions: Parameters, Return and Arrow Functions
TypeScript from Zero, episode 10: TypeScript Functions: Parameters, Return and Arrow Functions. Full code and real outputs, step by step.
Part 11
TypeScript Project Setup: npm init, tsconfig.json and tsc Explained
TypeScript from Zero, episode 11: TypeScript Project Setup: npm init, tsconfig.json and tsc Explained. Full code and real outputs, step by step.
Part 12
TypeScript Reading Input: process.argv, readline and @types/node
TypeScript from Zero, episode 12: TypeScript Reading Input: process.argv, readline and @types/node. Full code and real outputs, step by step.
Part 13
TypeScript Type Annotations vs Inference, Arrays and Tuples
TypeScript from Zero, episode 13: TypeScript Type Annotations vs Inference, Arrays and Tuples. Full code and real outputs, step by step.
Part 14
TypeScript Function Types: Optional, Default and Rest Parameters, void and never
TypeScript from Zero, episode 14: TypeScript Function Types: Optional, Default and Rest Parameters, void and never. Full code and real outputs, step by step.
Part 15
TypeScript type vs interface: Optional and readonly Properties
TypeScript from Zero, episode 15: TypeScript type vs interface: Optional and readonly Properties. Full code and real outputs, step by step.
Part 16
TypeScript Union Types and Narrowing: typeof, in and Array.isArray
TypeScript from Zero, episode 16: TypeScript Union Types and Narrowing: typeof, in and Array.isArray. Full code and real outputs, step by step.
Part 17
TypeScript null and undefined: Optional Chaining ?. , ?? and the ! Trap
TypeScript from Zero, episode 17: TypeScript null and undefined: Optional Chaining ?. , ?? and the ! Trap. Full code and real outputs, step by step.
Part 18
TypeScript Literal Types, as const and Why Node Rejects enum
TypeScript from Zero, episode 18: TypeScript Literal Types, as const and Why Node Rejects enum. Full code and real outputs, step by step.
Part 19
TypeScript Discriminated Unions and Exhaustive switch with never
TypeScript from Zero, episode 19: TypeScript Discriminated Unions and Exhaustive switch with never. Full code and real outputs, step by step.
Part 20
TypeScript any vs unknown, Type Assertions (as) and satisfies
TypeScript from Zero, episode 20: TypeScript any vs unknown, Type Assertions (as) and satisfies. Full code and real outputs, step by step.
Part 21
TypeScript Generics for Beginners: Generic Functions and extends Constraints
TypeScript from Zero, episode 21: TypeScript Generics for Beginners: Generic Functions and extends Constraints. Full code and real outputs, step by step.
Part 22
TypeScript Generic Types and Interfaces: Defaults and a Typed Result Type
TypeScript from Zero, episode 22: TypeScript Generic Types and Interfaces: Defaults and a Typed Result Type. Full code and real outputs, step by step.
Part 23
TypeScript Classes for Beginners: constructor, #private, implements, abstract
TypeScript from Zero, episode 23: TypeScript Classes for Beginners: constructor, #private, implements, abstract. Full code and real outputs, step by step.
Part 24
TypeScript Modules: import, export, import type and File Extensions
TypeScript from Zero, episode 24: TypeScript Modules: import, export, import type and File Extensions. Full code and real outputs, step by step.
Part 25
TypeScript Async Await for Beginners: setTimeout, Promises and the Forgotten await
TypeScript from Zero, episode 25: TypeScript Async Await for Beginners: setTimeout, Promises and the Forgotten await. Full code and real outputs, step by step.
Part 26
TypeScript Project: Task Tracker CLI, Project Setup and a Discriminated Union Model
TypeScript from Zero, episode 26: TypeScript Project: Task Tracker CLI, Project Setup and a Discriminated Union Model. Full code and real outputs, step by step.
Part 27
TypeScript CLI: Parsing Arguments with node:util parseArgs and Narrowing the Result
TypeScript from Zero, episode 27: TypeScript CLI: Parsing Arguments with node:util parseArgs and Narrowing the Result. Full code and real outputs, step by step.
Part 28
TypeScript: Save and Load a JSON File with node:fs/promises (readFile, writeFile)
TypeScript from Zero, episode 28: TypeScript: Save and Load a JSON File with node:fs/promises (readFile, writeFile). Full code and real outputs, step by step.
Part 29
TypeScript: JSON.parse Returns any - Use unknown and a Type Guard (value is Task)
TypeScript from Zero, episode 29: TypeScript: JSON.parse Returns any - Use unknown and a Type Guard (value is Task). Full code and real outputs, step by step.
Part 30
TypeScript Error Handling: try/catch with unknown, Custom Errors and Error.cause
TypeScript from Zero, episode 30: TypeScript Error Handling: try/catch with unknown, Custom Errors and Error.cause. Full code and real outputs, step by step.
Part 31
TypeScript map, filter, reduce, Object.entries, Record and Map for Beginners
TypeScript from Zero, episode 31: TypeScript map, filter, reduce, Object.entries, Record and Map for Beginners. Full code and real outputs, step by step.
Part 32
TypeScript Utility Types: Partial, Pick, Omit, Required, Readonly, ReturnType
TypeScript from Zero, episode 32: TypeScript Utility Types: Partial, Pick, Omit, Required, Readonly, ReturnType. Full code and real outputs, step by step.
Part 33
TypeScript: Build a CLI with tsc, the bin Field and npm link (Shebang Included)
TypeScript from Zero, episode 33: TypeScript: Build a CLI with tsc, the bin Field and npm link (Shebang Included). Full code and real outputs, step by step.
Part 34
TypeScript Zod 4 for Beginners: Schema, z.infer, safeParse and Readable Errors
TypeScript from Zero, episode 34: TypeScript Zod 4 for Beginners: Schema, z.infer, safeParse and Readable Errors. Full code and real outputs, step by step.
Part 35
TypeScript: Typed Config from process.env with Zod (Fail Fast, Defaults, --env-file)
TypeScript from Zero, episode 35: TypeScript: Typed Config from process.env with Zod (Fail Fast, Defaults, --env-file). Full code and real outputs, step by step.
Part 36
TypeScript HTTP API with node:http: Routes, Typed JSON Helper, 404 and --watch
TypeScript from Zero, episode 36: TypeScript HTTP API with node:http: Routes, Typed JSON Helper, 404 and --watch. Full code and real outputs, step by step.
Part 37
TypeScript API: Validate Request Bodies with Zod and Return 422 with Field Errors
TypeScript from Zero, episode 37: TypeScript API: Validate Request Bodies with Zod and Return 422 with Field Errors. Full code and real outputs, step by step.
Part 38
TypeScript fetch: Typed JSON Client with Zod, POST and AbortController Timeouts
TypeScript from Zero, episode 38: TypeScript fetch: Typed JSON Client with Zod, POST and AbortController Timeouts. Full code and real outputs, step by step.
Part 39
TypeScript EventEmitter with a Typed Event Map (node:events)
TypeScript from Zero, episode 39: TypeScript EventEmitter with a Typed Event Map (node:events). Full code and real outputs, step by step.
Part 40
TypeScript keyof, typeof and Indexed Access Types (T[K]) Explained
TypeScript from Zero, episode 40: TypeScript keyof, typeof and Indexed Access Types (T[K]) Explained. Full code and real outputs, step by step.
Part 41
TypeScript Mapped Types: [K in keyof T], readonly and Key Remapping with as
TypeScript from Zero, episode 41: TypeScript Mapped Types: [K in keyof T], readonly and Key Remapping with as. Full code and real outputs, step by step.
Part 42
TypeScript Conditional Types and infer: T extends U ? X : Y
TypeScript from Zero, episode 42: TypeScript Conditional Types and infer: T extends U ? X : Y. Full code and real outputs, step by step.
Part 43
TypeScript Template Literal Types: Typed Route Params from "/tasks/:id"
TypeScript from Zero, episode 43: TypeScript Template Literal Types: Typed Route Params from "/tasks/:id". Full code and real outputs, step by step.
Part 44
TypeScript Function Overloads and this Types (Error TS2769 and TS2684)
TypeScript from Zero, episode 44: TypeScript Function Overloads and this Types (Error TS2769 and TS2684). Full code and real outputs, step by step.
Part 45
TypeScript Declaration Files: .d.ts, declare module and @types Packages (TS7016)
TypeScript from Zero, episode 45: TypeScript Declaration Files: .d.ts, declare module and @types Packages (TS7016). Full code and real outputs, step by step.
Part 46
TypeScript Branded Types (UserId vs TaskId) and readonly Arrays
TypeScript from Zero, episode 46: TypeScript Branded Types (UserId vs TaskId) and readonly Arrays. Full code and real outputs, step by step.
Part 47
TypeScript Testing with Vitest: Unit Tests, Mocks (vi.fn) and expectTypeOf
TypeScript from Zero, episode 47: TypeScript Testing with Vitest: Unit Tests, Mocks (vi.fn) and expectTypeOf. Full code and real outputs, step by step.
Part 48
TypeScript Linting: ESLint Flat Config, typescript-eslint and TS 7 (ERESOLVE Fix)
TypeScript from Zero, episode 48: TypeScript Linting: ESLint Flat Config, typescript-eslint and TS 7 (ERESOLVE Fix). Full code and real outputs, step by step.
Part 49
TypeScript Project References: composite, tsc -b and Shared Types for CLI and API
TypeScript from Zero, episode 49: TypeScript Project References: composite, tsc -b and Shared Types for CLI and API. Full code and real outputs, step by step.
Part 50
TypeScript: Publish a Typed npm Package (exports, types, files) + Series Recap
TypeScript from Zero, episode 50: TypeScript: Publish a Typed npm Package (exports, types, files) + Series Recap. Full code and real outputs, step by step.