Skip to content

Add tests for Awaited<null> and Awaited<undefined> #52960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/baselines/reference/awaitedType.errors.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/compiler/awaitedType.ts(18,12): error TS2589: Type instantiation is excessively deep and possibly infinite.
tests/cases/compiler/awaitedType.ts(22,12): error TS2589: Type instantiation is excessively deep and possibly infinite.
tests/cases/compiler/awaitedType.ts(26,12): error TS2589: Type instantiation is excessively deep and possibly infinite.


==== tests/cases/compiler/awaitedType.ts (2 errors) ====
Expand All @@ -19,6 +19,10 @@ tests/cases/compiler/awaitedType.ts(22,12): error TS2589: Type instantiation is
type T14 = _Expect<Awaited<Promise<Promise<number>> | string | undefined>, /*expected*/ string | number | undefined>; // otherwise just prints T14 in types tests, which isn't very helpful
type T15 = _Expect<Awaited<Promise<Promise<number>> | string | null | undefined>, /*expected*/ string | number | null | undefined>; // otherwise just prints T15 in types tests, which isn't very helpful

type TUndefined = Awaited<undefined>;
type TNull = Awaited<null>;
type TNullOrUndefined = Awaited<null | undefined>;

interface BadPromise { then(cb: (value: BadPromise) => void): void; }
type T16 = Awaited<BadPromise>; // error
~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 4 additions & 0 deletions tests/baselines/reference/awaitedType.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ type T13 = _Expect<Awaited<Promise<Promise<number>> | string | null>, /*expected
type T14 = _Expect<Awaited<Promise<Promise<number>> | string | undefined>, /*expected*/ string | number | undefined>; // otherwise just prints T14 in types tests, which isn't very helpful
type T15 = _Expect<Awaited<Promise<Promise<number>> | string | null | undefined>, /*expected*/ string | number | null | undefined>; // otherwise just prints T15 in types tests, which isn't very helpful

type TUndefined = Awaited<undefined>;
type TNull = Awaited<null>;
type TNullOrUndefined = Awaited<null | undefined>;

interface BadPromise { then(cb: (value: BadPromise) => void): void; }
type T16 = Awaited<BadPromise>; // error

Expand Down
348 changes: 180 additions & 168 deletions tests/baselines/reference/awaitedType.symbols

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions tests/baselines/reference/awaitedType.types
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ type T15 = _Expect<Awaited<Promise<Promise<number>> | string | null | undefined>
>null : null
>null : null

type TUndefined = Awaited<undefined>;
>TUndefined : undefined

type TNull = Awaited<null>;
>TNull : null
>null : null

type TNullOrUndefined = Awaited<null | undefined>;
>TNullOrUndefined : null
>null : null

interface BadPromise { then(cb: (value: BadPromise) => void): void; }
>then : (cb: (value: BadPromise) => void) => void
>cb : (value: BadPromise) => void
Expand Down
6 changes: 5 additions & 1 deletion tests/baselines/reference/awaitedTypeStrictNull.errors.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tests/cases/compiler/awaitedTypeStrictNull.ts(18,12): error TS2589: Type instantiation is excessively deep and possibly infinite.
tests/cases/compiler/awaitedTypeStrictNull.ts(22,12): error TS2589: Type instantiation is excessively deep and possibly infinite.
tests/cases/compiler/awaitedTypeStrictNull.ts(26,12): error TS2589: Type instantiation is excessively deep and possibly infinite.


==== tests/cases/compiler/awaitedTypeStrictNull.ts (2 errors) ====
Expand All @@ -19,6 +19,10 @@ tests/cases/compiler/awaitedTypeStrictNull.ts(22,12): error TS2589: Type instant
type T14 = _Expect<Awaited<Promise<Promise<number>> | string | undefined>, /*expected*/ string | number | undefined>; // otherwise just prints T14 in types tests, which isn't very helpful
type T15 = _Expect<Awaited<Promise<Promise<number>> | string | null | undefined>, /*expected*/ string | number | null | undefined>; // otherwise just prints T15 in types tests, which isn't very helpful

type TUndefined = Awaited<undefined>;
type TNull = Awaited<null>;
type TNullOrUndefined = Awaited<null | undefined>;

interface BadPromise { then(cb: (value: BadPromise) => void): void; }
type T16 = Awaited<BadPromise>; // error
~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 4 additions & 0 deletions tests/baselines/reference/awaitedTypeStrictNull.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ type T13 = _Expect<Awaited<Promise<Promise<number>> | string | null>, /*expected
type T14 = _Expect<Awaited<Promise<Promise<number>> | string | undefined>, /*expected*/ string | number | undefined>; // otherwise just prints T14 in types tests, which isn't very helpful
type T15 = _Expect<Awaited<Promise<Promise<number>> | string | null | undefined>, /*expected*/ string | number | null | undefined>; // otherwise just prints T15 in types tests, which isn't very helpful

type TUndefined = Awaited<undefined>;
type TNull = Awaited<null>;
type TNullOrUndefined = Awaited<null | undefined>;

interface BadPromise { then(cb: (value: BadPromise) => void): void; }
type T16 = Awaited<BadPromise>; // error

Expand Down
Loading