Skip to content

    ↑↓ move · ⏎ open · esc close

    Async

    Awaited

    What you get after awaiting — however many promises deep it was.

    What it is

    The one built-in on this page that recurses. It models `await` rather than `Promise` unwrapping: a promise of a promise flattens, exactly as it does at run time, and a non-promise passes through unchanged. Reading the definition is the fastest way to understand why nested promises were never a thing you had to handle.

    Examples

    • Awaited<Promise<string>>
      string
    • Awaited<Promise<Promise<number>>>
      number

      Flattened all the way, because `await` does the same.

    • Awaited<string>
      string

      Awaiting a non-promise is legal and does nothing, and the type says so.

    Each resolved type above was printed by TypeScript 5.9.3, not written by hand.

    What it does not do

    • It does not unwrap anything inside an object. `Awaited<{ a: Promise<string> }>` is unchanged — this follows `await`, and `await` does not walk your properties.
    • It does not describe rejection. The error path has no type in TypeScript at all, which is why a caught error is `unknown`.

    Takeaway

    Use `Awaited<ReturnType<typeof fn>>` for the resolved result of an async function. That pair comes up more than either does alone.