Skip to content

Commit 8158db3

Browse files
committed
Test string unions
1 parent 09bc91e commit 8158db3

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

test/literal-unions/input.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface Params {
1717
referencedNumberUnion: NumberUnion;
1818
callback: (ref: StringUnion | undefined) => void;
1919
unionOfUnions: StringUnion | NumberUnion;
20+
unionAndLiteral: StringUnion | 'qux';
2021
}
2122

2223
type StringUnion = 'foo' | 'bar' | 'baz';

test/literal-unions/output.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,37 @@
194194
]
195195
},
196196
"optional": false
197+
},
198+
{
199+
"name": "unionAndLiteral",
200+
"type": {
201+
"kind": "union",
202+
"types": [
203+
{
204+
"kind": "union",
205+
"name": "StringUnion",
206+
"types": [
207+
{
208+
"kind": "literal",
209+
"value": "\"foo\""
210+
},
211+
{
212+
"kind": "literal",
213+
"value": "\"bar\""
214+
},
215+
{
216+
"kind": "literal",
217+
"value": "\"baz\""
218+
}
219+
]
220+
},
221+
{
222+
"kind": "literal",
223+
"value": "\"qux\""
224+
}
225+
]
226+
},
227+
"optional": false
197228
}
198229
]
199230
}
@@ -392,6 +423,10 @@
392423
{
393424
"kind": "literal",
394425
"value": "\"unionOfUnions\""
426+
},
427+
{
428+
"kind": "literal",
429+
"value": "\"unionAndLiteral\""
395430
}
396431
]
397432
}

0 commit comments

Comments
 (0)