UNPKG

399 BTypeScriptView Raw
1/**
2 * Get the result type of a `Promise`
3 * @param P A promise
4 * @returns [[Any]]
5 * @example
6 * ```ts
7 * import {C} from 'ts-toolbelt'
8 *
9 * const promise = new Promise<string>((res, rej) => res('x'))
10 *
11 * type test0 = C.Await<typeof promise> // string
12 * type test1 = C.Await<Promise<number>> // number
13 * ```
14 */
15export declare type Await<P extends any> = P extends Promise<infer A> ? A : P;