You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Compatible with versions below TypeScript 4.5 Awaited
74
+
*/
75
+
exporttypeAwaited<T>=
76
+
Textendsnull|undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode
77
+
Textendsobject&{then(onfulfilled: infer F, ...args: infer _): any} ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
78
+
Fextends((value: infer V, ...args: infer _)=>any) ? // if the argument to `then` is callable, extracts the first argument
79
+
Awaited<V> : // recursively unwrap the value
80
+
never : // the argument to `then` was not callable
0 commit comments