Skip to content

Commit d040db4

Browse files
committed
Add test for proper tuple type handling
1 parent cd70f22 commit d040db4

8 files changed

+28
-0
lines changed

tests/baselines/reference/intersectionTypeWithLeadingOperator.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ type A = & string;
33
type B =
44
& { foo: string }
55
& { bar: number };
6+
7+
type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }];
68

79

810
//// [intersectionTypeWithLeadingOperator.js]

tests/baselines/reference/intersectionTypeWithLeadingOperator.symbols

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@ type B =
1111
& { bar: number };
1212
>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 3, 5))
1313

14+
type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }];
15+
>C : Symbol(C, Decl(intersectionTypeWithLeadingOperator.ts, 3, 20))
16+
>foo : Symbol(foo, Decl(intersectionTypeWithLeadingOperator.ts, 5, 13))
17+
>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 5, 26))
18+
>foo : Symbol(foo, Decl(intersectionTypeWithLeadingOperator.ts, 5, 40))
19+
>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 5, 53))
20+

tests/baselines/reference/intersectionTypeWithLeadingOperator.types

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@ type B =
1111
& { bar: number };
1212
>bar : number
1313

14+
type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }];
15+
>C : [{ foo: 1; } & { bar: 2; }, { foo: 3; } & { bar: 4; }]
16+
>foo : 1
17+
>bar : 2
18+
>foo : 3
19+
>bar : 4
20+

tests/baselines/reference/unionTypeWithLeadingOperator.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ type A = | string;
33
type B =
44
| { type: "INCREMENT" }
55
| { type: "DECREMENT" };
6+
7+
type C = [| 0 | 1, | "foo" | "bar"];
68

79

810
//// [unionTypeWithLeadingOperator.js]

tests/baselines/reference/unionTypeWithLeadingOperator.symbols

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ type B =
1111
| { type: "DECREMENT" };
1212
>type : Symbol(type, Decl(unionTypeWithLeadingOperator.ts, 3, 5))
1313

14+
type C = [| 0 | 1, | "foo" | "bar"];
15+
>C : Symbol(C, Decl(unionTypeWithLeadingOperator.ts, 3, 26))
16+

tests/baselines/reference/unionTypeWithLeadingOperator.types

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ type B =
1111
| { type: "DECREMENT" };
1212
>type : "DECREMENT"
1313

14+
type C = [| 0 | 1, | "foo" | "bar"];
15+
>C : [0 | 1, "foo" | "bar"]
16+

tests/cases/compiler/intersectionTypeWithLeadingOperator.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ type A = & string;
22
type B =
33
& { foo: string }
44
& { bar: number };
5+
6+
type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }];

tests/cases/compiler/unionTypeWithLeadingOperator.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ type A = | string;
22
type B =
33
| { type: "INCREMENT" }
44
| { type: "DECREMENT" };
5+
6+
type C = [| 0 | 1, | "foo" | "bar"];

0 commit comments

Comments
 (0)