Course contentsShow
← TypeScript
Lesson 710 of 1,79616. Utility TypesFree lesson

Awaited<T> for Promise Unwrapping

Recursively unwrap Promise types to get the final resolved value type in async functions.

Awaited<T> for Promise Unwrapping

What you'll learn: How to use the Awaited<T> utility type to extract the final resolved value type from nested Promises in async code.


When working with async functions and Promises, TypeScript needs to know what type you'll actually get when the Promise resolves. The Awaited<T> utility type recursively unwraps Promise types to reveal the final value type you'll work with after awaiting.

The Problem: Nested Promise Types

Sometimes you have a function that returns a Promise, which itself resolves to another Promise. Manually figuring out the final type becomes tedious:

type NestedPromise = Promise<Promise<number>>;
// What type do you get after awaiting this twice?

How Awaited<T> Works

Awaited<T> recursively unwraps Promise layers until it reaches the actual value type:

type Result1 = Awaited<Promise<string>>;
// Result1 is string

type Result2 = Awaited<Promise<Promise<number>>>;
// Result2 is number (unwraps both layers!)

type Result3 = Awaited<Promise<Promise<Promise<boolean>>>>;
// Result3 is boolean (keeps unwrapping)

Practical Use in Async Functions

This is especially useful when working with the return types of async functions:

async function fetchUser() {
  return { id: 1, name: "Alice" };
}

type User = Awaited<ReturnType<typeof fetchUser>>;
// User is { id: number; name: string; }

Without Awaited, you'd get Promise<{ id: number; name: string; }> instead of the actual object type.

Key Takeaway: Awaited<T> recursively unwraps Promise types to give you the final resolved value type, making it easier to work with complex async function return types without manual Promise unwrapping.