Skip to content

Commit

Permalink
Add test for proper tuple type handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusschulz committed Nov 20, 2016
1 parent cd70f22 commit d040db4
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ type A = & string;
type B =
& { foo: string }
& { bar: number };

type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }];


//// [intersectionTypeWithLeadingOperator.js]
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ type B =
& { bar: number };
>bar : Symbol(bar, Decl(intersectionTypeWithLeadingOperator.ts, 3, 5))

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

Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ type B =
& { bar: number };
>bar : number

type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }];
>C : [{ foo: 1; } & { bar: 2; }, { foo: 3; } & { bar: 4; }]
>foo : 1
>bar : 2
>foo : 3
>bar : 4

2 changes: 2 additions & 0 deletions tests/baselines/reference/unionTypeWithLeadingOperator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ type A = | string;
type B =
| { type: "INCREMENT" }
| { type: "DECREMENT" };

type C = [| 0 | 1, | "foo" | "bar"];


//// [unionTypeWithLeadingOperator.js]
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ type B =
| { type: "DECREMENT" };
>type : Symbol(type, Decl(unionTypeWithLeadingOperator.ts, 3, 5))

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

3 changes: 3 additions & 0 deletions tests/baselines/reference/unionTypeWithLeadingOperator.types
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ type B =
| { type: "DECREMENT" };
>type : "DECREMENT"

type C = [| 0 | 1, | "foo" | "bar"];
>C : [0 | 1, "foo" | "bar"]

2 changes: 2 additions & 0 deletions tests/cases/compiler/intersectionTypeWithLeadingOperator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ type A = & string;
type B =
& { foo: string }
& { bar: number };

type C = [& { foo: 1 } & { bar: 2 }, & { foo: 3 } & { bar: 4 }];
2 changes: 2 additions & 0 deletions tests/cases/compiler/unionTypeWithLeadingOperator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ type A = | string;
type B =
| { type: "INCREMENT" }
| { type: "DECREMENT" };

type C = [| 0 | 1, | "foo" | "bar"];

0 comments on commit d040db4

Please sign in to comment.