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.
- 00Why switch? The honest listThe pros, the costs, and when plain JavaScript is fine
- 01Setting uptsc, tsconfig, strict, and running a .ts file
- 02Your first typesAnnotations, inference, and letting TypeScript work it out
- 03Objectstype or interface, optional and readonly properties
- 04Arrays, tuples and functionsParameter and return types, optional and default parameters
- 05Unions and narrowingtypeof, in, and discriminated unionsComing next
- 06null, undefined and strictnessstrictNullChecks, ?. and ??Coming next
- 07Generics, just enoughOne function for many typesComing next
- 08Utility typesPartial, Pick, Omit, Record, ReturnTypeComing next
- 09Data from outsideunknown vs any, typing fetch, checking JSONComing next
- 10Migrating a real projectallowJs, checkJs, JSDoc, and the strictness ladderComing next
- 11Traps and escape hatchesany, as, !, enums vs unions, and what to avoidComing next
- 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.
- 01The hook
- 02In JavaScript
- 03In TypeScript
- 04How it works
- 05Watch out
- 06Practise
- 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