@typespec/emitter-framework 0.3.0-dev.3 → 0.3.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/testing/scenario-test/snippet-extractor.d.ts +2 -2
- package/dist/src/testing/scenario-test/snippet-extractor.d.ts.map +1 -1
- package/dist/src/testing/scenario-test/snippet-extractor.js +2 -1
- package/dist/src/testing/scenario-test/snippet-extractor.js.map +1 -1
- package/dist/src/typescript/components/array-expression.d.ts +2 -1
- package/dist/src/typescript/components/array-expression.d.ts.map +1 -1
- package/dist/src/typescript/components/array-expression.js +3 -2
- package/dist/src/typescript/components/array-expression.js.map +1 -1
- package/dist/src/typescript/components/class-method.d.ts.map +1 -1
- package/dist/src/typescript/components/class-method.js.map +1 -1
- package/dist/src/typescript/components/enum-declaration.d.ts +4 -4
- package/dist/src/typescript/components/enum-declaration.d.ts.map +1 -1
- package/dist/src/typescript/components/enum-declaration.js +19 -15
- package/dist/src/typescript/components/enum-declaration.js.map +1 -1
- package/dist/src/typescript/components/function-declaration.d.ts.map +1 -1
- package/dist/src/typescript/components/function-declaration.js +1 -1
- package/dist/src/typescript/components/function-declaration.js.map +1 -1
- package/dist/src/typescript/components/interface-declaration.d.ts +3 -3
- package/dist/src/typescript/components/interface-declaration.d.ts.map +1 -1
- package/dist/src/typescript/components/interface-declaration.js +14 -7
- package/dist/src/typescript/components/interface-declaration.js.map +1 -1
- package/dist/src/typescript/components/interface-member.d.ts.map +1 -1
- package/dist/src/typescript/components/interface-member.js.map +1 -1
- package/dist/src/typescript/components/record-expression.js.map +1 -1
- package/dist/src/typescript/components/static-serializers.d.ts.map +1 -1
- package/dist/src/typescript/components/static-serializers.js +8 -8
- package/dist/src/typescript/components/static-serializers.js.map +1 -1
- package/dist/src/typescript/components/type-alias-declaration.d.ts.map +1 -1
- package/dist/src/typescript/components/type-alias-declaration.js +1 -1
- package/dist/src/typescript/components/type-alias-declaration.js.map +1 -1
- package/dist/src/typescript/components/type-declaration.js.map +1 -1
- package/dist/src/typescript/components/type-expression.d.ts.map +1 -1
- package/dist/src/typescript/components/type-expression.js +12 -5
- package/dist/src/typescript/components/type-expression.js.map +1 -1
- package/dist/src/typescript/components/type-transform.d.ts.map +1 -1
- package/dist/src/typescript/components/type-transform.js +32 -29
- package/dist/src/typescript/components/type-transform.js.map +1 -1
- package/dist/src/typescript/components/union-declaration.d.ts.map +1 -1
- package/dist/src/typescript/components/union-declaration.js.map +1 -1
- package/dist/src/typescript/components/union-expression.d.ts +2 -1
- package/dist/src/typescript/components/union-expression.d.ts.map +1 -1
- package/dist/src/typescript/components/union-expression.js +23 -24
- package/dist/src/typescript/components/union-expression.js.map +1 -1
- package/package.json +4 -4
- package/src/testing/scenario-test/snippet-extractor.ts +4 -3
- package/src/typescript/components/array-expression.tsx +2 -3
- package/src/typescript/components/class-method.tsx +14 -9
- package/src/typescript/components/enum-declaration.tsx +31 -28
- package/src/typescript/components/function-declaration.tsx +8 -4
- package/src/typescript/components/interface-declaration.tsx +23 -10
- package/src/typescript/components/interface-member.tsx +8 -4
- package/src/typescript/components/record-expression.tsx +1 -1
- package/src/typescript/components/static-serializers.tsx +78 -18
- package/src/typescript/components/type-alias-declaration.tsx +6 -4
- package/src/typescript/components/type-declaration.tsx +1 -1
- package/src/typescript/components/type-expression.tsx +10 -8
- package/src/typescript/components/type-transform.tsx +93 -49
- package/src/typescript/components/union-declaration.tsx +4 -2
- package/src/typescript/components/union-expression.tsx +25 -22
- package/test/typescript/components/enum-declaration.test.tsx +19 -11
- package/test/typescript/components/interface-declaration.test.tsx +41 -40
- package/test/typescript/components/member-expression.test.tsx +25 -16
- package/test/typescript/components/type-transform.test.tsx +21 -6
- package/test/typescript/components/union-declaration.test.tsx +6 -10
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
2
|
+
import { Children } from "@alloy-js/core";
|
|
2
3
|
import * as ts from "@alloy-js/typescript";
|
|
3
|
-
import { Enum, Union } from "@typespec/compiler";
|
|
4
|
-
import {
|
|
4
|
+
import { Enum, EnumMember, Union, UnionVariant } from "@typespec/compiler";
|
|
5
|
+
import { $ } from "@typespec/compiler/experimental/typekit";
|
|
6
|
+
import { TypeExpression } from "./type-expression.jsx";
|
|
5
7
|
|
|
6
8
|
export interface UnionExpressionProps {
|
|
7
9
|
type: Union | Enum;
|
|
@@ -9,28 +11,29 @@ export interface UnionExpressionProps {
|
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export function UnionExpression({ type, children }: UnionExpressionProps) {
|
|
12
|
-
|
|
14
|
+
const items = ($.union.is(type) ? type.variants : type.members) as Map<
|
|
15
|
+
string,
|
|
16
|
+
UnionVariant | EnumMember
|
|
17
|
+
>;
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
(_, variant) => {
|
|
26
|
-
return <TypeExpression type={variant.type} />;
|
|
27
|
-
},
|
|
28
|
-
{ joiner: " | " },
|
|
29
|
-
);
|
|
30
|
-
}
|
|
19
|
+
const variants = (
|
|
20
|
+
<ay.For joiner={" | "} each={items}>
|
|
21
|
+
{(_, value) => {
|
|
22
|
+
if ($.enumMember.is(value)) {
|
|
23
|
+
return <ts.ValueExpression jsValue={value.value ?? value.name} />;
|
|
24
|
+
} else {
|
|
25
|
+
return <TypeExpression type={value.type} />;
|
|
26
|
+
}
|
|
27
|
+
}}
|
|
28
|
+
</ay.For>
|
|
29
|
+
);
|
|
31
30
|
|
|
32
31
|
if (children || (Array.isArray(children) && children.length)) {
|
|
33
|
-
return
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
{variants} {` | ${children}`}
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
return variants;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { refkey } from "@alloy-js/core";
|
|
1
|
+
import { List, refkey, StatementList } from "@alloy-js/core";
|
|
2
2
|
import { d } from "@alloy-js/core/testing";
|
|
3
3
|
import { Enum, Union } from "@typespec/compiler";
|
|
4
4
|
import { describe, expect, it } from "vitest";
|
|
@@ -61,11 +61,15 @@ describe("Typescript Enum Declaration", () => {
|
|
|
61
61
|
|
|
62
62
|
const output = await getEmitOutput(code, (program) => {
|
|
63
63
|
const Foo = program.resolveTypeReference("Foo")[0]! as Enum;
|
|
64
|
-
return
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
return (
|
|
65
|
+
<List hardline>
|
|
66
|
+
<EnumDeclaration type={Foo} />
|
|
67
|
+
<StatementList>
|
|
68
|
+
{refkey(Foo)}
|
|
69
|
+
{refkey(Foo.members.get("one"))}
|
|
70
|
+
</StatementList>
|
|
71
|
+
</List>
|
|
72
|
+
);
|
|
69
73
|
});
|
|
70
74
|
|
|
71
75
|
expect(output).toBe(d`
|
|
@@ -90,11 +94,15 @@ describe("Typescript Enum Declaration", () => {
|
|
|
90
94
|
|
|
91
95
|
const output = await getEmitOutput(code, (program) => {
|
|
92
96
|
const Foo = program.resolveTypeReference("Foo")[0]! as Union;
|
|
93
|
-
return
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
return (
|
|
98
|
+
<List hardline>
|
|
99
|
+
<EnumDeclaration type={Foo} />
|
|
100
|
+
<StatementList>
|
|
101
|
+
{refkey(Foo)}
|
|
102
|
+
{refkey(Foo.variants.get("one"))}
|
|
103
|
+
</StatementList>
|
|
104
|
+
</List>
|
|
105
|
+
);
|
|
98
106
|
});
|
|
99
107
|
|
|
100
108
|
expect(output).toBe(d`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InterfaceDeclaration } from "../../../src/typescript/components/interface-declaration.js";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { For, List, Output, render } from "@alloy-js/core";
|
|
4
4
|
import { SourceFile } from "@alloy-js/typescript";
|
|
5
5
|
import { Namespace } from "@typespec/compiler";
|
|
6
6
|
import { format } from "prettier";
|
|
@@ -25,12 +25,14 @@ describe("Typescript Interface", () => {
|
|
|
25
25
|
|
|
26
26
|
const res = render(
|
|
27
27
|
<Output>
|
|
28
|
-
|
|
28
|
+
<SourceFile path="test.ts">
|
|
29
|
+
<List hardline>
|
|
29
30
|
{models.map((model) => (
|
|
30
31
|
<InterfaceDeclaration export type={model} />
|
|
31
32
|
))}
|
|
32
|
-
</
|
|
33
|
-
</
|
|
33
|
+
</List>
|
|
34
|
+
</SourceFile>
|
|
35
|
+
</Output>,
|
|
34
36
|
);
|
|
35
37
|
|
|
36
38
|
const testFile = res.contents.find((file) => file.path === "test.ts");
|
|
@@ -62,12 +64,12 @@ describe("Typescript Interface", () => {
|
|
|
62
64
|
|
|
63
65
|
const res = render(
|
|
64
66
|
<Output>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
<SourceFile path="test.ts">
|
|
68
|
+
<For each={Array.from(models.values())} hardline>
|
|
69
|
+
{(model) => <InterfaceDeclaration export type={model} />}
|
|
70
|
+
</For>
|
|
71
|
+
</SourceFile>
|
|
72
|
+
</Output>,
|
|
71
73
|
);
|
|
72
74
|
|
|
73
75
|
const testFile = res.contents.find((file) => file.path === "test.ts");
|
|
@@ -96,12 +98,12 @@ describe("Typescript Interface", () => {
|
|
|
96
98
|
|
|
97
99
|
const res = render(
|
|
98
100
|
<Output>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
<SourceFile path="test.ts">
|
|
102
|
+
<For each={Array.from(models.values())} hardline>
|
|
103
|
+
{(model) => <InterfaceDeclaration export type={model} />}
|
|
104
|
+
</For>
|
|
105
|
+
</SourceFile>
|
|
106
|
+
</Output>,
|
|
105
107
|
);
|
|
106
108
|
|
|
107
109
|
const testFile = res.contents.find((file) => file.path === "test.ts");
|
|
@@ -134,12 +136,12 @@ describe("Typescript Interface", () => {
|
|
|
134
136
|
|
|
135
137
|
const res = render(
|
|
136
138
|
<Output>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
<SourceFile path="test.ts">
|
|
140
|
+
<For each={Array.from(models.values())} hardline>
|
|
141
|
+
{(model) => <InterfaceDeclaration export type={model} />}
|
|
142
|
+
</For>
|
|
143
|
+
</SourceFile>
|
|
144
|
+
</Output>,
|
|
143
145
|
);
|
|
144
146
|
|
|
145
147
|
const testFile = res.contents.find((file) => file.path === "test.ts");
|
|
@@ -182,12 +184,12 @@ describe("Typescript Interface", () => {
|
|
|
182
184
|
|
|
183
185
|
const res = render(
|
|
184
186
|
<Output>
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
<SourceFile path="test.ts">
|
|
188
|
+
<For each={Array.from(models.values())} hardline>
|
|
189
|
+
{(model) => <InterfaceDeclaration export type={model} />}
|
|
190
|
+
</For>
|
|
191
|
+
</SourceFile>
|
|
192
|
+
</Output>,
|
|
191
193
|
);
|
|
192
194
|
|
|
193
195
|
const testFile = res.contents.find((file) => file.path === "test.ts");
|
|
@@ -229,12 +231,12 @@ describe("Typescript Interface", () => {
|
|
|
229
231
|
|
|
230
232
|
const res = render(
|
|
231
233
|
<Output>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
<SourceFile path="test.ts">
|
|
235
|
+
{models.map((model) => (
|
|
236
|
+
<InterfaceDeclaration export type={model} />
|
|
237
|
+
))}
|
|
238
|
+
</SourceFile>
|
|
239
|
+
</Output>,
|
|
238
240
|
);
|
|
239
241
|
|
|
240
242
|
const testFile = res.contents.find((file) => file.path === "test.ts");
|
|
@@ -276,10 +278,10 @@ describe("Typescript Interface", () => {
|
|
|
276
278
|
|
|
277
279
|
const res = render(
|
|
278
280
|
<Output>
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
<SourceFile path="test.ts">
|
|
282
|
+
<InterfaceDeclaration type={models[0]} />
|
|
283
|
+
</SourceFile>
|
|
284
|
+
</Output>,
|
|
283
285
|
);
|
|
284
286
|
|
|
285
287
|
const testFile = res.contents.find((file) => file.path === "test.ts");
|
|
@@ -391,8 +393,7 @@ describe("Typescript Interface", () => {
|
|
|
391
393
|
<Output>
|
|
392
394
|
<SourceFile path="test.ts">
|
|
393
395
|
<InterfaceDeclaration export name="MyOperations" type={models[0]}>
|
|
394
|
-
customProperty: string;
|
|
395
|
-
customMethod(): void;
|
|
396
|
+
customProperty: string; customMethod(): void;
|
|
396
397
|
</InterfaceDeclaration>
|
|
397
398
|
</SourceFile>
|
|
398
399
|
</Output>,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as ay from "@alloy-js/core";
|
|
1
2
|
import { d } from "@alloy-js/core/testing";
|
|
2
3
|
import { Enum, Model, Union } from "@typespec/compiler";
|
|
3
4
|
import { describe, expect, it } from "vitest";
|
|
@@ -20,10 +21,12 @@ describe("Typescript Enum Member Expression", () => {
|
|
|
20
21
|
`;
|
|
21
22
|
const output = await getEmitOutput(code, (program) => {
|
|
22
23
|
const Bar = program.resolveTypeReference("Bar")[0]! as Model;
|
|
23
|
-
return
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
return (
|
|
25
|
+
<ay.List hardline>
|
|
26
|
+
<EnumDeclaration type={program.resolveTypeReference("Foo")[0]! as Enum} />
|
|
27
|
+
<InterfaceDeclaration type={Bar} />
|
|
28
|
+
</ay.List>
|
|
29
|
+
);
|
|
27
30
|
});
|
|
28
31
|
|
|
29
32
|
expect(output).toBe(d`
|
|
@@ -52,10 +55,12 @@ describe("Typescript Enum Member Expression", () => {
|
|
|
52
55
|
`;
|
|
53
56
|
const output = await getEmitOutput(code, (program) => {
|
|
54
57
|
const Bar = program.resolveTypeReference("Bar")[0]! as Model;
|
|
55
|
-
return
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
return (
|
|
59
|
+
<ay.List hardline>
|
|
60
|
+
<EnumDeclaration type={program.resolveTypeReference("Foo")[0]! as Enum} />
|
|
61
|
+
<InterfaceDeclaration type={Bar} />
|
|
62
|
+
</ay.List>
|
|
63
|
+
);
|
|
59
64
|
});
|
|
60
65
|
|
|
61
66
|
expect(output).toBe(d`
|
|
@@ -86,10 +91,12 @@ describe("Typescript Union Member Expression", () => {
|
|
|
86
91
|
`;
|
|
87
92
|
const output = await getEmitOutput(code, (program) => {
|
|
88
93
|
const Bar = program.resolveTypeReference("Bar")[0]! as Model;
|
|
89
|
-
return
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
return (
|
|
95
|
+
<ay.List hardline>
|
|
96
|
+
<UnionDeclaration type={program.resolveTypeReference("Foo")[0]! as Union} />
|
|
97
|
+
<InterfaceDeclaration type={Bar} />
|
|
98
|
+
</ay.List>
|
|
99
|
+
);
|
|
93
100
|
});
|
|
94
101
|
|
|
95
102
|
expect(output).toBe(d`
|
|
@@ -114,10 +121,12 @@ describe("Typescript Union Member Expression", () => {
|
|
|
114
121
|
`;
|
|
115
122
|
const output = await getEmitOutput(code, (program) => {
|
|
116
123
|
const Bar = program.resolveTypeReference("Bar")[0]! as Model;
|
|
117
|
-
return
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
return (
|
|
125
|
+
<ay.List hardline>
|
|
126
|
+
<UnionDeclaration type={program.resolveTypeReference("Foo")[0]! as Union} />
|
|
127
|
+
<InterfaceDeclaration type={Bar} />
|
|
128
|
+
</ay.List>
|
|
129
|
+
);
|
|
121
130
|
});
|
|
122
131
|
|
|
123
132
|
expect(output).toBe(d`
|
|
@@ -45,7 +45,12 @@ describe.skip("Typescript Type Transform", () => {
|
|
|
45
45
|
{code`
|
|
46
46
|
const wireWidget = {id: "1", birth_year: 1988, color: "blue"};
|
|
47
47
|
`}
|
|
48
|
-
const clientWidget =
|
|
48
|
+
const clientWidget ={" "}
|
|
49
|
+
<ModelTransformExpression
|
|
50
|
+
type={Widget}
|
|
51
|
+
target="application"
|
|
52
|
+
itemPath={["wireWidget"]}
|
|
53
|
+
/>
|
|
49
54
|
</SourceFile>
|
|
50
55
|
</Output>,
|
|
51
56
|
);
|
|
@@ -81,7 +86,12 @@ describe.skip("Typescript Type Transform", () => {
|
|
|
81
86
|
{code`
|
|
82
87
|
const clientWidget = {id: "1", birthYear: 1988, color: "blue"};
|
|
83
88
|
`}
|
|
84
|
-
const wireWidget =
|
|
89
|
+
const wireWidget ={" "}
|
|
90
|
+
<ModelTransformExpression
|
|
91
|
+
type={Widget}
|
|
92
|
+
target="transport"
|
|
93
|
+
itemPath={["clientWidget"]}
|
|
94
|
+
/>
|
|
85
95
|
</SourceFile>
|
|
86
96
|
</Output>,
|
|
87
97
|
);
|
|
@@ -120,7 +130,12 @@ describe.skip("Typescript Type Transform", () => {
|
|
|
120
130
|
{code`
|
|
121
131
|
const wireWidget = {id: "1", birth_date: "1988-04-29T19:30:00Z", color: "blue"};
|
|
122
132
|
`}
|
|
123
|
-
const clientWidget =
|
|
133
|
+
const clientWidget ={" "}
|
|
134
|
+
<ModelTransformExpression
|
|
135
|
+
type={Widget}
|
|
136
|
+
target="application"
|
|
137
|
+
itemPath={["wireWidget"]}
|
|
138
|
+
/>
|
|
124
139
|
</SourceFile>
|
|
125
140
|
</Output>,
|
|
126
141
|
);
|
|
@@ -329,7 +344,7 @@ describe.skip("Typescript Type Transform", () => {
|
|
|
329
344
|
<SourceFile path="test.ts">
|
|
330
345
|
{code`
|
|
331
346
|
const clientWidget = {id: "1", my_color: "blue"};
|
|
332
|
-
const wireWidget = ${<TypeTransformCall itemPath={["clientWidget"]} type={Widget} collapse={true} target="transport" />}
|
|
347
|
+
const wireWidget = ${(<TypeTransformCall itemPath={["clientWidget"]} type={Widget} collapse={true} target="transport" />)}
|
|
333
348
|
`}
|
|
334
349
|
</SourceFile>
|
|
335
350
|
</Output>,
|
|
@@ -366,8 +381,8 @@ describe.skip("Typescript Type Transform", () => {
|
|
|
366
381
|
<SourceFile path="test.ts">
|
|
367
382
|
{code`
|
|
368
383
|
const wireWidget = {id: "1", my_color: "blue"};
|
|
369
|
-
const clientWidget = ${<ts.FunctionCallExpression
|
|
370
|
-
const wireWidget2 = ${<ts.FunctionCallExpression
|
|
384
|
+
const clientWidget = ${(<ts.FunctionCallExpression target={getTypeTransformerRefkey(Widget, "application")} args={[<>wireWidget</>]} />)};
|
|
385
|
+
const wireWidget2 = ${(<ts.FunctionCallExpression target={getTypeTransformerRefkey(Widget, "transport")} args={["clientWidget"]} />)};
|
|
371
386
|
`}
|
|
372
387
|
</SourceFile>
|
|
373
388
|
</Output>,
|
|
@@ -13,9 +13,7 @@ describe("Typescript Union Declaration", () => {
|
|
|
13
13
|
const res = render(
|
|
14
14
|
<Output>
|
|
15
15
|
<SourceFile path="test.ts">
|
|
16
|
-
<UnionDeclaration name="MyUnion">
|
|
17
|
-
"red" | "blue"
|
|
18
|
-
</UnionDeclaration>
|
|
16
|
+
<UnionDeclaration name="MyUnion">"red" | "blue"</UnionDeclaration>
|
|
19
17
|
</SourceFile>
|
|
20
18
|
</Output>,
|
|
21
19
|
);
|
|
@@ -105,9 +103,7 @@ describe("Typescript Union Declaration", () => {
|
|
|
105
103
|
const res = render(
|
|
106
104
|
<Output>
|
|
107
105
|
<SourceFile path="test.ts">
|
|
108
|
-
<UnionDeclaration type={union}>
|
|
109
|
-
"three"
|
|
110
|
-
</UnionDeclaration>
|
|
106
|
+
<UnionDeclaration type={union}>"three"</UnionDeclaration>
|
|
111
107
|
</SourceFile>
|
|
112
108
|
</Output>,
|
|
113
109
|
);
|
|
@@ -135,10 +131,10 @@ describe("Typescript Union Declaration", () => {
|
|
|
135
131
|
|
|
136
132
|
const res = render(
|
|
137
133
|
<Output>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
134
|
+
<SourceFile path="test.ts">
|
|
135
|
+
let x: <UnionExpression type={union} /> = "one";
|
|
136
|
+
</SourceFile>
|
|
137
|
+
</Output>,
|
|
142
138
|
);
|
|
143
139
|
|
|
144
140
|
const testFile = res.contents.find((file) => file.path === "test.ts");
|