M Logo
← All tutorials

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.

typescriptnodebeginnerstsc

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.

typescriptvariablesletconst

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.

typescriptnumbersmathnan

Part 4

TypeScript from Zero: Strings

Quotes, string helpers, template literals and the 5 + 3 trap in TypeScript, caught by tsc.

typescriptstringstemplate literals

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsbooleans comparisonsLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsif else switchLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsloops for whileLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsarraysLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsobjectsLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsfunctionsLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jstsconfig project setupLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsprocess.argv readline types nodeLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jstype annotations inference arrays tuplesLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsoptional default rest parameters void neverLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jstype interface readonly optional propertiesLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsunion types narrowing typeofLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsnull undefined optional chaining nullishLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsliteral types as const enumLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsdiscriminated unions exhaustive switch neverLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsany unknown as satisfiesLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsgenerics generic functions constraintsLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsgeneric types interfaces default type parameters ResultLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsclasses constructor private implements abstractLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsmodules import export import type extensionsLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsasync await promise settimeoutLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsproject task tracker cli setup discriminated unionLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsparseArgs node util cli arguments narrowingLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsnode fs promises readFile writeFile jsonLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsJSON.parse unknown type guard value isLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jserror handling try catch unknown custom error causeLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsmap filter reduce Object.entries Record MapLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsutility types Partial Pick Omit Required Readonly ReturnType AwaitedLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jstsc build dist bin npm link shebang cliLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jszod 4 schema z.infer safeParse validationLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jstyped config process.env zod coerce env-fileLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jshttp server node:http routes json 404 watchLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jspost request body validation zod 422 400 flattenErrorLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsfetch json client zod AbortController timeoutLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsEventEmitter node events typed event map genericsLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jskeyof typeof indexed access typesLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsmapped types key remapping as template literalLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsconditional types infer distributiveLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jstemplate literal types route params inferLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsfunction overloads this typesLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsdeclaration files d.ts declare module @types TS7016LCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsbranded types nominal readonly arraysLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsvitest testing unit tests mocks expectTypeOfLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jseslint flat config typescript-eslint no-floating-promises typescript 7LCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jsproject references composite tsc -b workspaces monorepoLCElearn coding easily

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.

typescripttypescript tutorialtypescript for beginnerslearn typescripttypescript from zeronode.jspublish npm package exports types declaration files dry-runLCElearn coding easily

© 2026 All Rights Reserved By Mahmudul Alam