All coursesWeb

12 free chapters and a certificate anyone can verify.

  • Free
  • 6 weeks
  • Intermediate
See the outline

Read the guide: How to learn TypeScript: a roadmap for JS developers

TypeScript code, strict type guards, and component interfaces in a modern code editor
Accredited Curriculum & Certification
Official Syllabus Snapshot

Direct Answer: Turn the bugs you currently find in production into red squiggles you find while typing — inference, unions, generics, and the patterns that make a large codebase safe to change.

Tuition Fee
100% Free
Duration & Workload
~10 Hours
Curriculum Depth
12 Chapters · 48 Lessons
Credential Awarded
Verified Certificate
12Chapters

Course outline

What a type checker actually buys you, how to configure tsc properly, and where annotations belong.

  • What Types Actually Catch12 min
  • tsc, tsconfig, and Strict Mode13 min
  • Primitives, Inference, and When to Annotate12 min
  • Type Checking JavaScript with JSDoc13 min

Interfaces, type aliases, unions, intersections, and the discriminated-union pattern that makes bad states impossible.

  • Interfaces vs Type Aliases12 min
  • Unions, Intersections, and Optional Properties13 min
  • Literal Types and Discriminated Unions14 min
  • Enums, and When to Avoid Them13 min

How TypeScript follows your control flow, how to teach it about runtime checks, and what unknown, any, and never are for.

  • Narrowing and Control Flow Analysis13 min
  • Type Guards, Predicates, and Assertion Functions14 min
  • unknown, any, and never13 min
  • Assertions and the Escape Hatches13 min

Writing code that works over many types without losing type information, and deriving types instead of duplicating them.

  • Generics from First Principles14 min
  • keyof, typeof, and Indexed Access12 min
  • The Utility Types You Will Use Weekly13 min
  • Function Overloads and Their Alternatives13 min

Async code, untrusted API data, declaration files, and typing React components and hooks.

  • Typing Async Code and API Responses14 min
  • Declaration Files and Third-Party Types12 min
  • Typing React Components and Hooks15 min
  • Migrating a JavaScript Project to TypeScript13 min

Conditional types, infer, template literals, key remapping, branded types, and satisfies — the tools for the last mile of precision.

  • Conditional Types and infer14 min
  • Template Literal Types and Key Remapping13 min
  • Branded Types and satisfies13 min
  • Variadic Tuples and Recursive Types14 min

Reading the errors tsc actually gives you, keeping check times survivable as a project grows, and testing types so a regression fails the build.

  • Reading and Debugging Type Errors14 min
  • Build Speed, Project References, and Monorepos14 min
  • Testing Types and Locking Them Down13 min
  • Upgrading TypeScript Without Breaking the Build13 min

Making the schema at each boundary the single source of truth, so what the checker believes about incoming data matches what actually arrives.

  • Parse, Don't Validate13 min
  • Schemas as the Single Source of Truth13 min
  • Typed Configuration, Environment, and Feature Flags13 min
  • Generated Types from OpenAPI, GraphQL, and SQL13 min

The assignability rules behind every error you get, every error you do not get, and the handful of places TypeScript is unsound on purpose.

  • How Assignability Actually Works13 min
  • Freshness, Widening, and Excess Property Checks13 min
  • Variance and Function Parameter Bivariance13 min
  • The Unsound Corners You Have to Know About13 min

Designing state, failure, and invariants so the compiler enforces the rules of the business instead of leaving them to convention and code review.

  • Modelling Failure as Data, Not Exceptions13 min
  • State Machines the Compiler Enforces13 min
  • readonly, Immutability, and Defensive Shapes13 min
  • Domain Types, Wire Types, and the Mapping Between Them13 min

What changes when your types become a public artefact, from inference and error messages to declaration emit, module resolution, and versioning.

  • Designing APIs That Infer for the Caller13 min
  • Error Messages Your Users Can Actually Read13 min
  • Declaration Emit, ESM, CJS, and Module Resolution13 min
  • Versioning Types and Deprecating Without Breakage13 min

Driving TypeScript's own API to refactor, enforce, and extend types across a codebase far too large to change by hand.

  • Reading Code with the Compiler API13 min
  • Codemods at Scale with ts-morph13 min
  • Lint Rules That Use the Type Checker13 min
  • Language Service Plugins and Bespoke Editor Tooling13 min

Final exam & certificate

  1. 01

    Topic checks

    Each one opens the next topic

  2. 02

    Chapter quizzes

    Each one opens the next chapter

  3. 03

    50-question final

    50 of 100 marks to pass

  4. 04

    Certificate

    Issued instantly, verifiable

One attempt, 60 minutes. If you don't pass, you can retake once after 30 days.

The course guide

How to learn TypeScript: a roadmap for JS developers

Architectural floor plan drawings on a desk with a mechanical pencil, a metal ruler, tape and a case of drafting pens

The fastest answer to how to learn TypeScript is to stop treating it as a new language. It is JavaScript with a checker that reads your code before it runs. So learn it in this order: turn on strict mode in a real project, learn to describe the shapes of your data with unions, let the checker narrow those unions for you, then learn generics, and only after that touch the clever type level features. If you already write JavaScript comfortably, you can be productive in TypeScript within a couple of weeks and genuinely good at it within a couple of months.

This guide walks through that roadmap step by step, lists the mistakes that keep people stuck at "TypeScript is just annoying", and explains what our free TypeScript for JavaScript Developers course covers, chapter by chapter.

Before you start: do you know enough JavaScript?

TypeScript adds nothing at runtime, so every confusing moment is either a JavaScript problem or a types problem, and you need to tell them apart. Be comfortable with:

  • objects, arrays, destructuring and spread
  • functions as values, callbacks and closures
  • promises and async/await
  • modules (import and export)
  • reading a stack trace without panic

If several feel shaky, spend a few weeks on plain JavaScript first through full stack web or frontend engineering.

Architectural Blueprint and Learning Stages for How to learn TypeScript: a roadmap for JS developers — Cortexis Roadmap Diagram
Figure 1: Complete step-by-step architectural workflow and technical execution stages for How to learn TypeScript: a roadmap for JS developers.

Why bother: what types actually catch

Here is the kind of bug that ships every week in JavaScript:

JavaScript
function totalPrice(order) {
  return order.items.reduce((sum, i) => sum + i.price * i.qty, 0);
}

totalPrice({ items: [{ price: '', qty: 2 }] }); // 0, a blank price is silently free

No crash, no stack trace, just a wrong number in your database. With a two line type, the editor flags it before you save the file:

TypeScript
type Item = { price: number; qty: number };
type Order = { items: Item[] };
// totalPrice({ items: [{ price: '', qty: 2 }] })
// Type 'string' is not assignable to type 'number'.

Types catch typos and renames, missing values (the endless "Cannot read properties of undefined") and wrong shapes across a function boundary. They do not catch wrong business logic, and they do not check data arriving from outside your program unless you make them.

How to learn TypeScript: the roadmap, step by step

StageWhat to learnYou are done when
1. Setuptsc, tsconfig.json, strict: truea small project compiles with zero errors in strict mode
2. Shapestype aliases, interfaces, unions, optional propertiesyou can type an API response by hand
3. Narrowingtypeof, in, discriminated unions, unknowna switch over a union errors when you forget a case
4. Genericstype parameters, keyof, utility typesyou write one generic helper instead of three copies
5. Real codeasync types, .d.ts files, React props and hooksa real feature ships in TypeScript with no any
6. Precisionconditional types, branded types, satisfiesyou can read a library's types without fear

Stage 1: get strict mode running on day one

Install TypeScript, run tsc --init, and set "strict": true. Do not start without it. Strict mode switches on strictNullChecks, which is the single flag that removes most undefined errors, and noImplicitAny, which stops values quietly losing their types. Learning TypeScript with strict mode off teaches you a weaker language and leaves you with habits to unlearn.

Then learn when not to annotate: annotate function parameters and exported return types, and let inference handle local variables.

Stage 2: describe shapes, and lean on unions

Learn type and interface (they overlap a lot; pick one style and stay consistent), optional properties, and above all union types. The most useful pattern in the entire language is the discriminated union:

TypeScript
type RequestState =
  | { status: 'loading' }
  | { status: 'error'; message: string }
  | { status: 'done'; data: User[] };

With this, "loading but also has data" simply cannot be written. Bad states become unrepresentable.

Stage 3: narrowing and the edges

TypeScript follows your if statements. After if (req.status === 'error'), it knows message exists. Learn type guards, predicates and assertion functions for when the built in checks are not enough. Learn the difference between unknown (a value you must check before using) and any (a value the checker stops caring about). Use never to make a switch fail to compile when someone adds a new case and forgets to handle it.

Stage 4: generics without fear

Generics are parameters for types. Start with first<T>(items: T[]): T | undefined, then learn keyof, typeof, indexed access and the weekly utility types: Partial, Pick, Omit, Record, ReturnType. The goal is deriving types instead of copying them.

Stage 5: TypeScript in a real codebase

Most tutorials stop too early here. Type async functions and API responses (res.json() hands you any), write a declaration file for an untyped package, type React components and hooks, and migrate a JavaScript project gradually. If you are on the backend side, pairing this stage with a Node.js backend project works well; our guide on how to learn Node.js backend shows the API you could build.

Stage 6: the type level tools, last

Conditional types, infer, template literals, branded types and satisfies are powerful, and they are where beginners lose weeks writing types nobody can read. Learn them after shipping real code.

Mistakes that keep people stuck

Reaching for any whenever an error appears. Every any is a hole that spreads: whatever touches it loses its type too. Use unknown and narrow it.

Using as to silence the checker. An assertion says "trust me", and usually hides the bug the error was pointing at.

Trusting types at the boundary. A type annotation on JSON.parse output is a promise, not a check. Data from an API, a form or an environment variable must be validated at runtime, with a schema library such as Zod or your own guards, before the type means anything.

Not reading the error. TypeScript errors look long, but the most specific line is often the last one in the chain, so try reading from the bottom up.

What the free TypeScript course covers

TypeScript for JavaScript Developers is an intermediate, text based course built around the roadmap above. It has 12 chapters with four lessons each, a quiz after every topic, and a final exam. Each chapter is meant to leave you able to fix a specific real failure.

ChapterWhat you learn
1. Why Types, and Getting Them Runningwhat types catch, tsc, tsconfig and strict mode, inference, type checking JavaScript with JSDoc
2. Describing Shapesinterfaces vs type aliases, unions and intersections, literal types and discriminated unions, when to avoid enums
3. Narrowing, Guards, and the Edges of the Type Systemcontrol flow analysis, type guards and assertion functions, unknown, any and never, escape hatches
4. Generics and Type Transformationsgenerics from first principles, keyof and typeof, utility types, function overloads
5. TypeScript in a Real Codebasetyping async code and API responses, declaration files, React components and hooks, migrating a JS project
6. Types That Computeconditional types and infer, template literal types, branded types and satisfies, recursive types
7. Keeping a Large Codebase Fast and Greenreading type errors, build speed and project references, testing types, upgrading TypeScript safely
8. Where Types Meet Real Dataparse, don't validate, schemas as the single source of truth, typed config and env, generated types from OpenAPI, GraphQL and SQL
9. Why the Checker Says Yeshow assignability works, excess property checks, variance, the unsound corners
10. Modelling a Domain in Typesfailure as data, state machines the compiler enforces, readonly, domain types vs wire types
11. Shipping Types Other People Depend OnAPIs that infer for the caller, readable error messages, ESM, CJS and module resolution, versioning types
12. Programming the Compiler Itselfthe compiler API, codemods with ts-morph, type aware lint rules, language service plugins

Chapters 1 to 5 are what most working developers need. Chapters 6 to 12 are for people maintaining large codebases or publishing libraries.

Who it is for, and how long it takes

The course is for people who already write JavaScript: frontend developers moving a React app to TypeScript, Node developers tired of runtime surprises, and students whose internship codebase turned out to be TypeScript. It is not a first programming course. If you are still choosing a first language, read which programming language to learn first instead.

The suggested pace is 6 weeks. The reading is roughly ten and a half hours, but typing the examples into an editor, breaking them and watching the errors change is where TypeScript sticks. With an hour or so a day, six weeks is realistic.

How the quizzes and free certificate work

Each topic has a minimum reading time of 90 seconds before its quiz opens, and you need 70 percent on that quiz to unlock the next topic. Chapter quizzes are practice with instant feedback.

The certificate comes from the final exam: 50 questions, 60 minutes, one timed attempt, and you pass with 50 out of 100 marks. If you do not pass, a retake opens 30 days later with the questions and options reshuffled. Pass, and you get a free certificate with a verification code and a QR code anyone can check. Keep it in proportion: a reviewer will learn more from a repository with strict mode on and no stray any than from any certificate, ours included.


Ready to start? Open TypeScript for JavaScript Developers, switch on strict mode in a project you already have, and work through Chapter 1 this week. The red squiggles are the point.

Questions, answered

05 questions