Type Alias Awaited<T>

    Awaited: T extends null
    | undefined
        ? T
        : T extends object & { then(onfulfilled: F, ...args: _): any }
            ? F extends (value: infer V, ...args: infer _) => 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