/** Returns the type that is wrapped inside a `Promise` type. If the type is a nested Promise, it is unwrapped recursively until a non-Promise type is obtained. If the type is not a `Promise`, the type itself is returned. @example ``` import {PromiseValue} from 'type-fest'; type AsyncData = Promise; let asyncData: PromiseValue = Promise.resolve('ABC'); type Data = PromiseValue; let data: Data = await asyncData; // Here's an example that shows how this type reacts to non-Promise types. type SyncData = PromiseValue; let syncData: SyncData = getSyncData(); // Here's an example that shows how this type reacts to recursive Promise types. type RecursiveAsyncData = Promise >; let recursiveAsyncData: PromiseValue = Promise.resolve(Promise.resolve('ABC')); ``` */ export type PromiseValue = PromiseType extends Promise ? { 0: PromiseValue; 1: Value }[PromiseType extends Promise ? 0 : 1] : Otherwise;