Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / ansi-escapes / node_modules / type-fest / source / promise-value.d.ts
1 /**
2 Returns the type that is wrapped inside a `Promise` type.
3 If the type is not a `Promise`, the type itself is returned.
4
5 @example
6 ```
7 import {PromiseValue} from 'type-fest';
8
9 type AsyncData = Promise<string>;
10 let asyncData: PromiseValue<AsyncData> = Promise.resolve('ABC');
11
12 type Data = PromiseValue<AsyncData>;
13 let data: Data = await asyncData;
14
15 // Here's an example that shows how this type reacts to non-Promise types.
16 type SyncData = PromiseValue<string>;
17 let syncData: SyncData = getSyncData();
18 ```
19 */
20 export type PromiseValue<PromiseType, Otherwise = PromiseType> = PromiseType extends Promise<infer Value> ? Value : Otherwise;