UnwrapPromise<T>:T extends null | undefined ? T : T extends object & { then(onfulfilled: F, ...args: _): any; } ? F extends ((value: infer V, ...args: infer _) => any) ? V : never : T
Unwraps the "awaited type" of the Promise, but only once (unlike Awaited which is recursive). Non-promise "thenables" should resolve to never. This DOESNT emulate the behavior of await, it just unwraps the type of top-level Promise.
Unwraps the "awaited type" of the Promise, but only once (unlike Awaited which is recursive). Non-promise "thenables" should resolve to
never
. This DOESNT emulate the behavior ofawait
, it just unwraps the type of top-level Promise.Based 99% on Awaited from es5.lib.