Awaited<T>
Models the result of recursively unwrapping a Promise with await.
Syntax
Awaited<Type> Returns
type — The value type obtained by awaiting T, recursively unwrapping nested promises.
Examples
type A = Awaited<Promise<string>>; // string
type B = Awaited<Promise<Promise<number>>>; // number
async function load() {
return { ok: true };
}
type Data = Awaited<ReturnType<typeof load>>;
// { ok: boolean }
Notes
Recursively unwraps thenables, mirroring the behaviour of `await`. Non-promise
types pass through unchanged. Frequently composed with `ReturnType` to get the
resolved value of an async function.