Awaited<T>: T extends null | undefined
    ? T
    : T extends object & {
            then(onfulfilled, ...args): any;
        }
        ? F extends ((value, ...args) => any)
            ? Awaited<V>
            : never
        : T

Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to never. This emulates the behavior of await.

Type Parameters

  • T