Awaited<T>
Last updated: 2026-10-22
Awaited<T> Awaited
Awaited<T> mirrors the type effect of await: unwrapping Promise<T> into T, recursively expanding nested Promises (Promise<Promise<T>>) too. To get "the success result type of an async function", Awaited<ReturnType<typeof fn>> is the standard combo.
| Group | Utility Types |
|---|---|
| Kind | Type |
| Strict mode | Not required |
ℹ️ Info The editor transpiles TypeScript to JavaScript and runs it (no type checking); see each example's Output for type-check results.
📝 Syntax
// Simplified implementation (the official one also handles thenables)
type Awaited<T> = T extends Promise<infer V> ? Awaited<V> : T;
// Usage
type User = Awaited<ReturnType<typeof fetchUser>>; // unwraps Promise<User>
⚙️ Parameters
| T | Any type: Promises (and thenables) are unwrapped recursively; everything else passes through |
|---|
Returns:The type of T after awaiting: the final value type with the whole Promise chain expanded.
▶ Example
Edit the code below and click Try it to see the transpiled result:
Output:
1: Ada
done
(Runtime output after transpilation; at the type level LoadedUser is { id: number; name: string } rather than Promise<...> — Awaited has unwrapped it, so user.id is directly accessible)
💡 Notes
ℹ️ Info Awaited is a recursive conditional type: on a Promise it infers the inner type and recurses until a non-Promise remains. It is the same mechanism TS uses internally to type await expressions.
⚠️ Note Awaited unwraps at the type level only; it does not wait for you. Forgetting await at runtime still yields a Promise object — a correct type does not mean you wrote await.
💡 Tip Combos: Awaited<ReturnType<typeof fn>> extracts an async function's success result; in Promise.all's result type every member is also expanded through Awaited.
🏷️ Related Utility Types
💡 Related cases
More cases coming soon.
📚 Related tutorials
❓ FAQ
Q How does Awaited<T> differ from T extends Promise<infer U>?
A A hand-written non-recursive conditional unwraps only one layer and mishandles nested Promise<Promise<T>>; the official Awaited recurses and also supports thenables (objects with a custom then method). Prefer Awaited for generality.
Q What happens when awaiting a plain value?
A At runtime await on a non-Promise returns the value unchanged; at the type level Awaited<string> is also string. So typing possibly-Promise values with Awaited is always safe.
Q How do I type the result of Promise.all?
A No need to hand-write: Promise.all over a tuple returns each member's Awaited expansion automatically. To reference the type, declare const results = await Promise.all([...]) and use typeof results.