Skip to content

Commit 7e8f046

Browse files
committed
Remove the specialcase intended for strictNullChecks: false in Awaited
1 parent f2df10f commit 7e8f046

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Diff for: src/lib/es5.d.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -1522,12 +1522,11 @@ interface Promise<T> {
15221522
* Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`.
15231523
*/
15241524
type Awaited<T> =
1525-
T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode
1526-
T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
1527-
F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument
1528-
Awaited<V> : // recursively unwrap the value
1529-
never : // the argument to `then` was not callable
1530-
T; // non-object or non-thenable
1525+
T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
1526+
F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument
1527+
Awaited<V> : // recursively unwrap the value
1528+
never : // the argument to `then` was not callable
1529+
T; // non-object or non-thenable
15311530

15321531
interface ArrayLike<T> {
15331532
readonly length: number;

0 commit comments

Comments
 (0)