Skip to content

Awaited Type

In one line

Awaited<T> unwraps nested Promises — Awaited<Promise<Promise<number>>> is number.

In simple words

The Awaited<T> utility type (TypeScript 4.5+) recursively unwraps Promise types to get the final resolved value type. It's what async/await uses internally.

Awaited<Promise<number>> is number. Awaited<Promise<Promise<string>>> is string (recursively unwraps). Awaited<number> is number (non-promises pass through).

This is useful for:

  1. Extracting async function return types — Awaited<ReturnType<typeof fetchData>>
  2. Working with thenable types — handles custom Promise-like objects
  3. Type inference in async generators — getting the yielded value type

It's the foundation of async function return type inference.

Example

typescript
type T1 = Awaited<Promise<number>>; // number
type T2 = Awaited<Promise<Promise<string>>>; // string (recursive)
type T3 = Awaited<number | Promise<string>>; // number | string
type T4 = Awaited<boolean>; // boolean (non-promise passes through)

// Practical use: extract async function return type
async function fetchUser(): Promise<{ name: string; age: number }> {
  return { name: "Alice", age: 30 };
}
type User = Awaited<ReturnType<typeof fetchUser>>; // { name: string; age: number }

// Without Awaited, ReturnType would be Promise<{ name: string; age: number }>

Awaited recursively unwraps Promises to their resolved type. Useful for extracting the actual value type from async functions.

Common confusions

  • Confused with: Promise type

    The difference: Promise<T> is the type of a promise that resolves to T. Awaited<Promise<T>> is T — it unwraps the promise. Awaited handles nested promises and union types, always giving you the final resolved value type.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary