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.

GroupUtility Types
KindType
Strict modeNot 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

TAny 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.
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.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏