Skip to content
JavaScript to TypeScript · Free lessons

The Switch

JavaScript to TypeScript, for people who already write JavaScript.

The lessons

The lessons

Thirteen lessons planned. Five are ready, and the rest are coming next.

  1. 00Why switch? The honest listThe pros, the costs, and when plain JavaScript is fine
  2. 01Setting uptsc, tsconfig, strict, and running a .ts file
  3. 02Your first typesAnnotations, inference, and letting TypeScript work it out
  4. 03Objectstype or interface, optional and readonly properties
  5. 04Arrays, tuples and functionsParameter and return types, optional and default parameters
  6. 05Unions and narrowingtypeof, in, and discriminated unionsComing next
  7. 06null, undefined and strictnessstrictNullChecks, ?. and ??Coming next
  8. 07Generics, just enoughOne function for many typesComing next
  9. 08Utility typesPartial, Pick, Omit, Record, ReturnTypeComing next
  10. 09Data from outsideunknown vs any, typing fetch, checking JSONComing next
  11. 10Migrating a real projectallowJs, checkJs, JSDoc, and the strictness ladderComing next
  12. 11Traps and escape hatchesany, as, !, enums vs unions, and what to avoidComing next
  13. 12The cheat sheetEvery JS-to-TS pattern on one pageComing next
How a lesson is built

Seven parts, every time

So you always know where the traps are.

  1. 01The hook
  2. 02In JavaScript
  3. 03In TypeScript
  4. 04How it works
  5. 05Watch out
  6. 06Practise
  7. 07Interview notes

Every piece of TypeScript on these pages is a real file that is type-checked with strict mode on, and tested, before the page is built. The snippets that are meant to fail are checked to fail with the error shown. Your progress is kept in this browser only. Nothing is sent anywhere.

Made by VeraStack Labs