courses / typescript / level 3

level 3 · expert

advanced
typescript.

Write TypeScript like a professional: types that build types, unions you can trust, and tested, shipped tools.

  • 28 lessons
  • 7 units
  • 5 h 40 m in all
  • £0, for good

what’s inside.

For people who build things on their own and want code that others trust and can change.

TypeScript Level 3 is for learners who finished Levels 1 and 2 and want to write code the way professionals do. In 28 lessons you master generic constraints, mapped, conditional and template literal types, discriminated unions with exhaustive checks, type guards, branded types and unit tests. It ends with a level check: a shipped order checker that fetches from a practice server and handles every kind of bad input.

every lesson goes the same way.

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

unit 1

Sharper functions

Type functions as precisely as the data they handle.

4 lessons · 47 min

  1. Functions are values11 minStore functions in boxes, pass them around and label them with function types.
  2. Generic constraints12 minTell a generic what it can count on, and still keep the caller's full type.
  3. Rest parameters and spread11 minAccept any number of arguments, and unpack arrays into calls.
  4. Overloads13 minGive one function several exact signatures, so every call gets the right type.

unit 2

Types from values

Let TypeScript read your values and write the types for you.

4 lessons · 46 min

  1. Keep exact values with as const11 minStop TypeScript widening your values, and lock them so nobody changes them.
  2. Check without forgetting: satisfies12 minMake sure a value fits a type while keeping every detail about it.
  3. Types from values with typeof11 minWrite a value once and copy its type, so the two never drift apart.
  4. Every key with keyof12 minTurn an object's keys into a type, so misspelt keys are caught early.

unit 3

Reshaping types

Build new types from old ones instead of copying them out.

4 lessons · 47 min

  1. Look types up by key11 minRead the type of one property, and return exactly the right type for each key.
  2. Mapped types13 minBuild a new type with one property for every key of another type.
  3. Partial, Required and Readonly11 minUse TypeScript's ready-made mapped types for updates, defaults and locked data.
  4. Pick and Omit12 minCut a big type down to a smaller one that shares only what it should.

unit 4

Types that decide

Write types that ask a question and choose an answer.

4 lessons · 50 min

  1. Conditional types12 minWrite types that ask a yes-or-no question and pick an answer.
  2. Filtering unions13 minSee how conditional types split unions, and use them as filters.
  3. Capture types with infer13 minPull a piece out of a type, like the item type of a list.
  4. ReturnType, Parameters and Awaited12 minRead types straight off the functions you already have.

unit 5

Text as types

Teach the checker exactly which strings are allowed.

4 lessons · 48 min

  1. Template literal types11 minDescribe the shape a string must have, and let the checker enforce it.
  2. String helper types10 minChange the letters of literal types to build new names automatically.
  3. Key remapping13 minRename every key of a type as you map it, and drop the keys you do not want.
  4. A typed event map14 minSend and receive events where every name and every payload is checked.

unit 6

Unions you can trust

Model every case and let the checker prove you handled them all.

4 lessons · 50 min

  1. Discriminated unions13 minGive every member of a union a label, and let the checker tell them apart.
  2. Exhaustive checks with never12 minMake the checker prove that every member of a union is handled.
  3. Type guards13 minWrite your own checks for unknown data, and teach the checker to trust them.
  4. Assertion functions12 minStop the program at once when data is wrong, and narrow it when it is right.

unit 7

Ship it

Build, test and ship typed code like a professional.

4 lessons · 52 min

  1. Branded types12 minStop look-alike values, like emails and IDs, from getting mixed up.
  2. Results instead of crashes13 minCatch errors where they happen, and make failure part of the return type.
  3. Unit tests12 minWrite small tests that check your code every time it runs.
  4. Putting it all together15 minWrap requests to the practice server in one safe, typed function.
end of level 3 level check: a typed order checker Build one small project with everything from this level. Pass it and your face levels up. see the check

finished typescript?

pick your next language.

see all courses