TypeScript in the Browser: DOM and Async
Type the page you work with: DOM elements and events, promises and async code, data from fetch, errors, and browser storage, all checked by the compiler.
Most TypeScript you write for the web touches things that TypeScript did not create: the DOM (the tree of elements the browser builds from your HTML), events, promises, network responses and storage. This phase shows how TypeScript describes each of them, and where it can only take your word for it.
You'll learn to read Element | null without fear, to tell a harmless cast from a lie, to type events and your own custom events, to follow what a promise really returns, and to treat data from the network as unknown until a runtime check proves what it is.
Every example runs with a real page next to it. The Types panel shows what tsc says about your code, and the page and the Console show what it does. Phase 14 builds on this with React.
Practise this phase
Hands-on exercises: write the code, see your page live, and press Check to have it tested automatically.