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
// To prevent users with TypeScript versions lower than 4.5 from encountering unsupported Awaited<T> type, a copy has been made here.
17
-
exporttypeAwaited<T>=Textendsnull|undefined
18
-
? T// special case for `null | undefined` when not in `--strictNullChecks` mode
19
-
: Textendsobject&{then(onfulfilled: infer F, ...args: infer _): any}// `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
20
-
? Fextends(value: infer V, ...args: infer _)=>any// if the argument to `then` is callable, extracts the first argument
21
-
? Awaited<V>// recursively unwrap the value
22
-
: never// the argument to `then` was not callable
23
-
: T// non-object or non-thenable
24
-
25
16
/**
26
17
* Utility for extracting the parameters from a function overload (for typed emits)
0 commit comments