0Pricing
TypeScript Academy · Lesson

Promise<T>, async/await typing

Understand Promise shapes, annotate async functions, and work with awaited values safely.

Intro

Goal: Read and write Promise<T>-based code. You will type async functions, await values, and keep errors typed.

Promise basics

Promise<T> wraps an eventual value. Use Promise when no value resolves.

function delay(ms: number): Promise<void> {
  return new Promise(resolve => setTimeout(resolve, ms));
}

const p: Promise<void> = delay(100);

p.then(() => console.log("done"));

All lessons in this course

  1. Promise , async/await typing
  2. Error typing (unknown), narrowing in catch
  3. Concurrency patterns (all/settled/race) types
← Back to TypeScript Academy