@typespec/emitter-framework 0.9.0-dev.6 → 0.9.0-dev.8

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.
Files changed (154) hide show
  1. package/dist/src/core/components/output.d.ts +4 -4
  2. package/dist/src/core/components/output.d.ts.map +1 -1
  3. package/dist/src/core/components/output.js +3 -3
  4. package/dist/src/core/context/name-policy-context.d.ts +2 -2
  5. package/dist/src/core/context/name-policy-context.d.ts.map +1 -1
  6. package/dist/src/core/context/tsp-context.d.ts +2 -2
  7. package/dist/src/core/context/tsp-context.d.ts.map +1 -1
  8. package/dist/src/core/transport-name-policy.d.ts +1 -1
  9. package/dist/src/core/transport-name-policy.d.ts.map +1 -1
  10. package/dist/src/core/write-output.d.ts +2 -2
  11. package/dist/src/core/write-output.d.ts.map +1 -1
  12. package/dist/src/csharp/components/class/declaration.d.ts +3 -3
  13. package/dist/src/csharp/components/class/declaration.d.ts.map +1 -1
  14. package/dist/src/csharp/components/class/declaration.js +2 -2
  15. package/dist/src/csharp/components/class/declaration.test.js +100 -115
  16. package/dist/src/csharp/components/{enum-declaration.d.ts → enum/declaration.d.ts} +4 -4
  17. package/dist/src/csharp/components/enum/declaration.d.ts.map +1 -0
  18. package/dist/src/csharp/components/{enum-declaration.js → enum/declaration.js} +6 -6
  19. package/dist/src/csharp/components/enum/declaration.test.d.ts +2 -0
  20. package/dist/src/csharp/components/enum/declaration.test.d.ts.map +1 -0
  21. package/dist/src/csharp/components/enum/declaration.test.js +309 -0
  22. package/dist/src/csharp/components/index.d.ts +1 -1
  23. package/dist/src/csharp/components/index.js +1 -1
  24. package/dist/src/csharp/components/property/property.d.ts +2 -2
  25. package/dist/src/csharp/components/property/property.d.ts.map +1 -1
  26. package/dist/src/csharp/components/property/property.test.js +14 -14
  27. package/dist/src/csharp/components/type-expression.d.ts +3 -3
  28. package/dist/src/csharp/components/type-expression.d.ts.map +1 -1
  29. package/dist/src/csharp/components/utils/doc-comments.d.ts +4 -4
  30. package/dist/src/csharp/components/utils/doc-comments.d.ts.map +1 -1
  31. package/dist/src/csharp/components/utils/doc-comments.js +2 -2
  32. package/dist/src/testing/index.d.ts +1 -1
  33. package/dist/src/testing/index.d.ts.map +1 -1
  34. package/dist/src/testing/scenario-test/harness.d.ts +2 -2
  35. package/dist/src/testing/scenario-test/harness.d.ts.map +1 -1
  36. package/dist/src/testing/scenario-test/test-host.d.ts +2 -2
  37. package/dist/src/testing/scenario-test/test-host.d.ts.map +1 -1
  38. package/dist/src/typescript/components/array-expression.d.ts +2 -3
  39. package/dist/src/typescript/components/array-expression.d.ts.map +1 -1
  40. package/dist/src/typescript/components/array-expression.js +2 -2
  41. package/dist/src/typescript/components/arrow-function.d.ts +1 -1
  42. package/dist/src/typescript/components/arrow-function.d.ts.map +1 -1
  43. package/dist/src/typescript/components/class-method.d.ts +1 -1
  44. package/dist/src/typescript/components/class-method.d.ts.map +1 -1
  45. package/dist/src/typescript/components/enum-declaration.d.ts +6 -6
  46. package/dist/src/typescript/components/enum-declaration.d.ts.map +1 -1
  47. package/dist/src/typescript/components/enum-declaration.js +2 -2
  48. package/dist/src/typescript/components/function-declaration.d.ts +1 -1
  49. package/dist/src/typescript/components/function-declaration.d.ts.map +1 -1
  50. package/dist/src/typescript/components/function-expression.d.ts +1 -1
  51. package/dist/src/typescript/components/function-expression.d.ts.map +1 -1
  52. package/dist/src/typescript/components/function-type.d.ts +1 -1
  53. package/dist/src/typescript/components/function-type.d.ts.map +1 -1
  54. package/dist/src/typescript/components/interface-declaration.d.ts +4 -4
  55. package/dist/src/typescript/components/interface-declaration.d.ts.map +1 -1
  56. package/dist/src/typescript/components/interface-declaration.js +3 -4
  57. package/dist/src/typescript/components/interface-member.d.ts +2 -2
  58. package/dist/src/typescript/components/interface-member.d.ts.map +1 -1
  59. package/dist/src/typescript/components/interface-method.d.ts +2 -2
  60. package/dist/src/typescript/components/interface-method.d.ts.map +1 -1
  61. package/dist/src/typescript/components/record-expression.d.ts +1 -1
  62. package/dist/src/typescript/components/record-expression.d.ts.map +1 -1
  63. package/dist/src/typescript/components/type-alias-declaration.d.ts +1 -1
  64. package/dist/src/typescript/components/type-alias-declaration.d.ts.map +1 -1
  65. package/dist/src/typescript/components/type-declaration.d.ts +1 -1
  66. package/dist/src/typescript/components/type-declaration.d.ts.map +1 -1
  67. package/dist/src/typescript/components/type-expression.d.ts +1 -1
  68. package/dist/src/typescript/components/type-expression.d.ts.map +1 -1
  69. package/dist/src/typescript/components/type-transform.d.ts +2 -2
  70. package/dist/src/typescript/components/type-transform.d.ts.map +1 -1
  71. package/dist/src/typescript/components/union-declaration.d.ts +2 -2
  72. package/dist/src/typescript/components/union-declaration.d.ts.map +1 -1
  73. package/dist/src/typescript/components/union-expression.d.ts +3 -4
  74. package/dist/src/typescript/components/union-expression.d.ts.map +1 -1
  75. package/dist/src/typescript/components/union-expression.js +3 -3
  76. package/dist/src/typescript/components/value-expression.d.ts +2 -2
  77. package/dist/src/typescript/components/value-expression.d.ts.map +1 -1
  78. package/dist/src/typescript/utils/operation.d.ts +2 -2
  79. package/dist/src/typescript/utils/operation.d.ts.map +1 -1
  80. package/dist/test/typescript/components/member-expression.test.js +5 -5
  81. package/dist/test/typescript/test-host.d.ts +1 -1
  82. package/dist/test/typescript/test-host.d.ts.map +1 -1
  83. package/dist/test/utils.d.ts +2 -2
  84. package/dist/test/utils.d.ts.map +1 -1
  85. package/package.json +7 -4
  86. package/src/core/components/output.tsx +9 -5
  87. package/src/core/context/name-policy-context.ts +2 -2
  88. package/src/core/context/tsp-context.ts +2 -2
  89. package/src/core/transport-name-policy.ts +1 -1
  90. package/src/core/write-output.ts +2 -2
  91. package/src/csharp/components/class/declaration.test.tsx +107 -169
  92. package/src/csharp/components/class/declaration.tsx +8 -8
  93. package/src/csharp/components/enum/declaration.test.tsx +267 -0
  94. package/src/csharp/components/{enum-declaration.tsx → enum/declaration.tsx} +9 -9
  95. package/src/csharp/components/index.ts +1 -1
  96. package/src/csharp/components/property/property.test.tsx +16 -16
  97. package/src/csharp/components/property/property.tsx +2 -2
  98. package/src/csharp/components/type-expression.test.tsx +3 -3
  99. package/src/csharp/components/type-expression.tsx +3 -3
  100. package/src/csharp/components/utils/doc-comments.tsx +6 -6
  101. package/src/testing/index.ts +1 -1
  102. package/src/testing/scenario-test/harness.ts +2 -2
  103. package/src/testing/scenario-test/test-host.ts +4 -4
  104. package/src/typescript/components/array-expression.tsx +3 -3
  105. package/src/typescript/components/arrow-function.tsx +1 -1
  106. package/src/typescript/components/class-method.tsx +1 -1
  107. package/src/typescript/components/enum-declaration.tsx +6 -6
  108. package/src/typescript/components/function-declaration.tsx +1 -1
  109. package/src/typescript/components/function-expression.tsx +1 -1
  110. package/src/typescript/components/function-type.tsx +1 -1
  111. package/src/typescript/components/interface-declaration.tsx +11 -12
  112. package/src/typescript/components/interface-member.tsx +2 -2
  113. package/src/typescript/components/interface-method.tsx +2 -2
  114. package/src/typescript/components/record-expression.tsx +1 -1
  115. package/src/typescript/components/type-alias-declaration.tsx +1 -1
  116. package/src/typescript/components/type-declaration.tsx +1 -1
  117. package/src/typescript/components/type-expression.tsx +2 -2
  118. package/src/typescript/components/type-transform.tsx +3 -3
  119. package/src/typescript/components/union-declaration.tsx +2 -2
  120. package/src/typescript/components/union-expression.tsx +12 -7
  121. package/src/typescript/components/value-expression.tsx +2 -2
  122. package/src/typescript/utils/operation.ts +2 -2
  123. package/test/testing/snippet-extractor-csharp.test.ts +1 -1
  124. package/test/testing/snippet-extractor-java.test.ts +1 -1
  125. package/test/testing/snippet-extractor-python.test.ts +1 -1
  126. package/test/testing/snippet-extractor-typescript.test.ts +1 -1
  127. package/test/typescript/components/arrow-function.test.tsx +2 -2
  128. package/test/typescript/components/enum-declaration.test.tsx +1 -1
  129. package/test/typescript/components/function-declaration.test.tsx +1 -1
  130. package/test/typescript/components/function-expression.test.tsx +2 -2
  131. package/test/typescript/components/function-type.test.tsx +2 -2
  132. package/test/typescript/components/interface-declaration.test.tsx +1 -1
  133. package/test/typescript/components/interface-method.test.tsx +2 -2
  134. package/test/typescript/components/member-expression.test.tsx +10 -10
  135. package/test/typescript/components/type-alias-declaration.test.tsx +1 -1
  136. package/test/typescript/components/type-transform.test.tsx +2 -2
  137. package/test/typescript/components/union-declaration.test.tsx +2 -2
  138. package/test/typescript/components/value-expression.test.tsx +6 -6
  139. package/test/typescript/test-host.ts +1 -1
  140. package/test/utils.ts +2 -2
  141. package/tsconfig.json +1 -0
  142. package/dist/src/csharp/components/enum-declaration.d.ts.map +0 -1
  143. package/dist/test/csharp/components/enum-declaration.test.d.ts +0 -2
  144. package/dist/test/csharp/components/enum-declaration.test.d.ts.map +0 -1
  145. package/dist/test/csharp/components/enum-declaration.test.js +0 -403
  146. package/dist/test/csharp/test-host.d.ts +0 -11
  147. package/dist/test/csharp/test-host.d.ts.map +0 -1
  148. package/dist/test/csharp/test-host.js +0 -32
  149. package/dist/test/csharp/utils.d.ts +0 -3
  150. package/dist/test/csharp/utils.d.ts.map +0 -1
  151. package/dist/test/csharp/utils.js +0 -6
  152. package/test/csharp/components/enum-declaration.test.tsx +0 -337
  153. package/test/csharp/test-host.ts +0 -42
  154. package/test/csharp/utils.ts +0 -8
@@ -0,0 +1,267 @@
1
+ import { Tester } from "#test/test-host.js";
2
+ import { type Children } from "@alloy-js/core";
3
+ import { createCSharpNamePolicy, Namespace, SourceFile } from "@alloy-js/csharp";
4
+ import { t, type TesterInstance } from "@typespec/compiler/testing";
5
+ import { beforeEach, expect, it } from "vitest";
6
+ import { Output } from "../../../core/index.js";
7
+ import { EnumDeclaration } from "../../index.js";
8
+
9
+ let runner: TesterInstance;
10
+
11
+ beforeEach(async () => {
12
+ runner = await Tester.createInstance();
13
+ });
14
+
15
+ function Wrapper(props: { children: Children }) {
16
+ const policy = createCSharpNamePolicy();
17
+ return (
18
+ <Output program={runner.program} namePolicy={policy}>
19
+ <Namespace name="TestNamespace">
20
+ <SourceFile path="test.cs">{props.children}</SourceFile>
21
+ </Namespace>
22
+ </Output>
23
+ );
24
+ }
25
+
26
+ it("renders a basic enum declaration", async () => {
27
+ const { TestEnum } = await runner.compile(t.code`
28
+ @test enum ${t.enum("TestEnum")} {
29
+ Value1;
30
+ Value2;
31
+ Value3;
32
+ }
33
+ `);
34
+
35
+ expect(
36
+ <Wrapper>
37
+ <EnumDeclaration type={TestEnum} />
38
+ </Wrapper>,
39
+ ).toRenderTo(`
40
+ namespace TestNamespace
41
+ {
42
+ enum TestEnum
43
+ {
44
+ Value1,
45
+ Value2,
46
+ Value3
47
+ }
48
+ }
49
+ `);
50
+ });
51
+
52
+ it("renders an empty enum declaration", async () => {
53
+ const { TestEnum } = await runner.compile(t.code`
54
+ @test enum ${t.enum("TestEnum")} {}
55
+ `);
56
+
57
+ expect(
58
+ <Wrapper>
59
+ <EnumDeclaration type={TestEnum} />
60
+ </Wrapper>,
61
+ ).toRenderTo(`
62
+ namespace TestNamespace
63
+ {
64
+ enum TestEnum
65
+ {
66
+
67
+ }
68
+ }
69
+ `);
70
+ });
71
+
72
+ it("can override enum name", async () => {
73
+ const { TestEnum } = await runner.compile(t.code`
74
+ @test enum ${t.enum("TestEnum")} {
75
+ Value1;
76
+ Value2;
77
+ }
78
+ `);
79
+
80
+ expect(
81
+ <Wrapper>
82
+ <EnumDeclaration type={TestEnum} name="CustomEnumName" />
83
+ </Wrapper>,
84
+ ).toRenderTo(`
85
+ namespace TestNamespace
86
+ {
87
+ enum CustomEnumName
88
+ {
89
+ Value1,
90
+ Value2
91
+ }
92
+ }
93
+ `);
94
+ });
95
+
96
+ it("renders an enum with access modifiers", async () => {
97
+ const { TestEnum } = await runner.compile(t.code`
98
+ @test enum ${t.enum("TestEnum")} {
99
+ Value1;
100
+ Value2;
101
+ }
102
+ `);
103
+
104
+ expect(
105
+ <Wrapper>
106
+ <EnumDeclaration type={TestEnum} internal />
107
+ </Wrapper>,
108
+ ).toRenderTo(`
109
+ namespace TestNamespace
110
+ {
111
+ internal enum TestEnum
112
+ {
113
+ Value1,
114
+ Value2
115
+ }
116
+ }
117
+ `);
118
+ });
119
+
120
+ it("renders enum with C# naming conventions", async () => {
121
+ const { TestEnum } = await runner.compile(t.code`
122
+ @test enum ${t.enum("TestEnum")} {
123
+ value_one;
124
+ value_two;
125
+ value_three;
126
+ }
127
+ `);
128
+
129
+ expect(
130
+ <Output program={runner.program} namePolicy={createCSharpNamePolicy()}>
131
+ <Namespace name="TestNamespace">
132
+ <SourceFile path="test.cs">
133
+ <EnumDeclaration type={TestEnum} />
134
+ </SourceFile>
135
+ </Namespace>
136
+ </Output>,
137
+ ).toRenderTo(`
138
+ namespace TestNamespace
139
+ {
140
+ enum TestEnum
141
+ {
142
+ ValueOne,
143
+ ValueTwo,
144
+ ValueThree
145
+ }
146
+ }
147
+ `);
148
+ });
149
+
150
+ it("renders enum with single value", async () => {
151
+ const { TestEnum } = await runner.compile(t.code`
152
+ @test enum ${t.enum("TestEnum")} {
153
+ OnlyValue;
154
+ }
155
+ `);
156
+
157
+ expect(
158
+ <Wrapper>
159
+ <EnumDeclaration type={TestEnum} />
160
+ </Wrapper>,
161
+ ).toRenderTo(`
162
+ namespace TestNamespace
163
+ {
164
+ enum TestEnum
165
+ {
166
+ OnlyValue
167
+ }
168
+ }
169
+ `);
170
+ });
171
+
172
+ it("renders enum with numeric-like member names", async () => {
173
+ const { TestEnum } = await runner.compile(t.code`
174
+ @test enum ${t.enum("TestEnum")} {
175
+ Value0;
176
+ Value1;
177
+ Value10;
178
+ Value100;
179
+ }
180
+ `);
181
+
182
+ expect(
183
+ <Wrapper>
184
+ <EnumDeclaration type={TestEnum} />
185
+ </Wrapper>,
186
+ ).toRenderTo(`
187
+ namespace TestNamespace
188
+ {
189
+ enum TestEnum
190
+ {
191
+ Value0,
192
+ Value1,
193
+ Value10,
194
+ Value100
195
+ }
196
+ }
197
+ `);
198
+ });
199
+
200
+ it("renders multiple enums in the same namespace", async () => {
201
+ const { TestEnum1, TestEnum2 } = await runner.compile(t.code`
202
+ @test enum ${t.enum("TestEnum1")} {
203
+ Value1;
204
+ Value2;
205
+ }
206
+ @test enum ${t.enum("TestEnum2")} {
207
+ OptionA;
208
+ OptionB;
209
+ OptionC;
210
+ }
211
+ `);
212
+
213
+ expect(
214
+ <Wrapper>
215
+ <EnumDeclaration type={TestEnum1} />
216
+ <hbr />
217
+ <EnumDeclaration type={TestEnum2} />
218
+ </Wrapper>,
219
+ ).toRenderTo(`
220
+ namespace TestNamespace
221
+ {
222
+ enum TestEnum1
223
+ {
224
+ Value1,
225
+ Value2
226
+ }
227
+ enum TestEnum2
228
+ {
229
+ OptionA,
230
+ OptionB,
231
+ OptionC
232
+ }
233
+ }
234
+ `);
235
+ });
236
+
237
+ it("renders an enum with doc comments", async () => {
238
+ const { TestEnum } = await runner.compile(t.code`
239
+ @test enum ${t.enum("TestEnum")} {
240
+ @doc("This is value one")
241
+ Value1;
242
+ /** This is value two */
243
+ Value2;
244
+ }
245
+ `);
246
+
247
+ expect(
248
+ <Wrapper>
249
+ <EnumDeclaration type={TestEnum} />
250
+ </Wrapper>,
251
+ ).toRenderTo(`
252
+ namespace TestNamespace
253
+ {
254
+ enum TestEnum
255
+ {
256
+ /// <summary>
257
+ /// This is value one
258
+ /// </summary>
259
+ Value1,
260
+ /// <summary>
261
+ /// This is value two
262
+ /// </summary>
263
+ Value2
264
+ }
265
+ }
266
+ `);
267
+ });
@@ -1,17 +1,17 @@
1
- import * as ay from "@alloy-js/core";
1
+ import { useTsp } from "#core/context/tsp-context.js";
2
+ import { type Children, For } from "@alloy-js/core";
2
3
  import * as cs from "@alloy-js/csharp";
3
- import { Enum, Union } from "@typespec/compiler";
4
- import { useTsp } from "../../core/index.js";
5
- import { reportDiagnostic } from "../../lib.js";
6
- import { getDocComments } from "./utils/doc-comments.jsx";
7
- import { declarationRefkeys, efRefkey } from "./utils/refkey.js";
4
+ import type { Enum, Union } from "@typespec/compiler";
5
+ import { reportDiagnostic } from "../../../lib.js";
6
+ import { getDocComments } from "../utils/doc-comments.jsx";
7
+ import { declarationRefkeys, efRefkey } from "../utils/refkey.js";
8
8
 
9
9
  export interface EnumDeclarationProps extends Omit<cs.EnumDeclarationProps, "name"> {
10
10
  name?: string;
11
11
  type: Union | Enum;
12
12
  }
13
13
 
14
- export function EnumDeclaration(props: EnumDeclarationProps): ay.Children {
14
+ export function EnumDeclaration(props: EnumDeclarationProps): Children {
15
15
  const { $ } = useTsp();
16
16
  let type: Enum;
17
17
  if ($.union.is(props.type)) {
@@ -33,7 +33,7 @@ export function EnumDeclaration(props: EnumDeclarationProps): ay.Children {
33
33
  return (
34
34
  <>
35
35
  <cs.EnumDeclaration name={name} refkey={refkeys} {...props}>
36
- <ay.For each={members} joiner={",\n"}>
36
+ <For each={members} joiner={",\n"}>
37
37
  {([key, value]) => {
38
38
  return (
39
39
  <>
@@ -49,7 +49,7 @@ export function EnumDeclaration(props: EnumDeclarationProps): ay.Children {
49
49
  </>
50
50
  );
51
51
  }}
52
- </ay.For>
52
+ </For>
53
53
  </cs.EnumDeclaration>
54
54
  </>
55
55
  );
@@ -1,4 +1,4 @@
1
1
  export * from "./class/declaration.js";
2
- export * from "./enum-declaration.jsx";
2
+ export * from "./enum/declaration.jsx";
3
3
  export * from "./property/property.jsx";
4
4
  export * from "./type-expression.jsx";
@@ -1,7 +1,7 @@
1
1
  import { Tester } from "#test/test-host.js";
2
- import { Children } from "@alloy-js/core";
2
+ import { type Children } from "@alloy-js/core";
3
3
  import { ClassDeclaration, createCSharpNamePolicy, Namespace, SourceFile } from "@alloy-js/csharp";
4
- import { t, TesterInstance } from "@typespec/compiler/testing";
4
+ import { t, type TesterInstance } from "@typespec/compiler/testing";
5
5
  import { beforeEach, describe, expect, it } from "vitest";
6
6
  import { Output } from "../../../core/components/output.jsx";
7
7
  import { Property } from "./property.jsx";
@@ -39,10 +39,10 @@ it("maps prop: string | null to nullable property", async () => {
39
39
  ).toRenderTo(`
40
40
  namespace TestNamespace
41
41
  {
42
- class Test
43
- {
44
- public required string? Prop1 { get; set; }
45
- }
42
+ class Test
43
+ {
44
+ public required string? Prop1 { get; set; }
45
+ }
46
46
  }
47
47
  `);
48
48
  });
@@ -62,11 +62,11 @@ describe("jsonAttributes", () => {
62
62
  ).toRenderTo(`
63
63
  namespace TestNamespace
64
64
  {
65
- class Test
66
- {
67
- [System.Text.Json.JsonPropertyName("prop1")]
68
- public required string Prop1 { get; set; }
69
- }
65
+ class Test
66
+ {
67
+ [System.Text.Json.JsonPropertyName("prop1")]
68
+ public required string Prop1 { get; set; }
69
+ }
70
70
  }
71
71
  `);
72
72
  });
@@ -86,11 +86,11 @@ describe("jsonAttributes", () => {
86
86
  ).toRenderTo(`
87
87
  namespace TestNamespace
88
88
  {
89
- class Test
90
- {
91
- [System.Text.Json.JsonPropertyName("prop_1")]
92
- public required string Prop1 { get; set; }
93
- }
89
+ class Test
90
+ {
91
+ [System.Text.Json.JsonPropertyName("prop_1")]
92
+ public required string Prop1 { get; set; }
93
+ }
94
94
  }
95
95
  `);
96
96
  });
@@ -1,7 +1,7 @@
1
- import { Children } from "@alloy-js/core";
1
+ import { type Children } from "@alloy-js/core";
2
2
  import * as cs from "@alloy-js/csharp";
3
3
  import { Attribute } from "@alloy-js/csharp";
4
- import { ModelProperty, resolveEncodedName, Type } from "@typespec/compiler";
4
+ import { type ModelProperty, resolveEncodedName, type Type } from "@typespec/compiler";
5
5
  import { useTsp } from "../../../core/index.js";
6
6
  import { TypeExpression } from "../type-expression.jsx";
7
7
  import { getDocComments } from "../utils/doc-comments.jsx";
@@ -1,8 +1,8 @@
1
- import { Children, render } from "@alloy-js/core";
1
+ import { type Children, render } from "@alloy-js/core";
2
2
  import { d } from "@alloy-js/core/testing";
3
3
  import { Namespace, SourceFile } from "@alloy-js/csharp";
4
- import { Model, ModelProperty } from "@typespec/compiler";
5
- import { BasicTestRunner } from "@typespec/compiler/testing";
4
+ import type { Model, ModelProperty } from "@typespec/compiler";
5
+ import type { BasicTestRunner } from "@typespec/compiler/testing";
6
6
  import { beforeEach, describe, it } from "vitest";
7
7
  import { createEmitterFrameworkTestRunner } from "../../../test/typescript/test-host.js";
8
8
  import { assertFileContents } from "../../../test/utils.js";
@@ -1,7 +1,7 @@
1
- import { Children, code } from "@alloy-js/core";
1
+ import { type Children, code } from "@alloy-js/core";
2
2
  import { Reference } from "@alloy-js/csharp";
3
- import { getTypeName, IntrinsicType, Scalar, Type } from "@typespec/compiler";
4
- import { Typekit } from "@typespec/compiler/typekit";
3
+ import { getTypeName, type IntrinsicType, type Scalar, type Type } from "@typespec/compiler";
4
+ import type { Typekit } from "@typespec/compiler/typekit";
5
5
  import { useTsp } from "../../core/index.js";
6
6
  import { reportTypescriptDiagnostic } from "../../typescript/lib.js";
7
7
  import { efRefkey } from "./utils/refkey.js";
@@ -1,7 +1,7 @@
1
- import * as ay from "@alloy-js/core";
1
+ import { type Children, List } from "@alloy-js/core";
2
2
  import * as cs from "@alloy-js/csharp";
3
- import { getReturnsDoc, Type } from "@typespec/compiler";
4
- import { Typekit } from "@typespec/compiler/typekit";
3
+ import { getReturnsDoc, type Type } from "@typespec/compiler";
4
+ import type { Typekit } from "@typespec/compiler/typekit";
5
5
 
6
6
  /**
7
7
  * Helper to render a doc string for a given TypeSpec type.
@@ -12,13 +12,13 @@ import { Typekit } from "@typespec/compiler/typekit";
12
12
  * @param type The TypeSpec type to generate documentation for
13
13
  * @returns A DocSummary component containing the rendered doc string, or undefined if no doc is available.
14
14
  */
15
- export function getDocComments($: Typekit, type: Type): ay.Children {
15
+ export function getDocComments($: Typekit, type: Type): Children {
16
16
  const typeDoc = $.type.getDoc(type);
17
17
  if (!typeDoc) {
18
18
  return undefined;
19
19
  }
20
20
 
21
- const docElements: ay.Children[] = [];
21
+ const docElements: Children[] = [];
22
22
 
23
23
  // Add main type documentation
24
24
  docElements.push(
@@ -54,5 +54,5 @@ export function getDocComments($: Typekit, type: Type): ay.Children {
54
54
  }
55
55
  }
56
56
 
57
- return <ay.List doubleHardline>{docElements}</ay.List>;
57
+ return <List doubleHardline>{docElements}</List>;
58
58
  }
@@ -1,5 +1,5 @@
1
1
  import { resolvePath } from "@typespec/compiler";
2
- import { createTestLibrary, TypeSpecTestLibrary } from "@typespec/compiler/testing";
2
+ import { createTestLibrary, type TypeSpecTestLibrary } from "@typespec/compiler/testing";
3
3
  import { fileURLToPath } from "url";
4
4
 
5
5
  export const EmitterFrameworkTestLibrary: TypeSpecTestLibrary = createTestLibrary({
@@ -1,11 +1,11 @@
1
1
  import { normalizePath } from "@typespec/compiler";
2
- import { TypeSpecTestLibrary } from "@typespec/compiler/testing";
2
+ import type { TypeSpecTestLibrary } from "@typespec/compiler/testing";
3
3
  import { readdirSync, readFileSync, statSync, writeFileSync } from "fs";
4
4
  import minimist from "minimist";
5
5
  import path from "path";
6
6
  import { format } from "prettier";
7
7
  import { afterAll, describe, expect, it } from "vitest";
8
- import { LanguageConfiguration, SnippetExtractor } from "./snippet-extractor.js";
8
+ import type { LanguageConfiguration, SnippetExtractor } from "./snippet-extractor.js";
9
9
  import { emitWithDiagnostics } from "./test-host.js";
10
10
 
11
11
  const rawArgs = process.env.TEST_ARGS ? process.env.TEST_ARGS.split(" ") : [];
@@ -1,10 +1,10 @@
1
- import { CompilerOptions, Diagnostic } from "@typespec/compiler";
1
+ import type { CompilerOptions, Diagnostic } from "@typespec/compiler";
2
2
  import {
3
- BasicTestRunner,
3
+ type BasicTestRunner,
4
4
  createTestHost,
5
5
  createTestWrapper,
6
- TestHostConfig,
7
- TypeSpecTestLibrary,
6
+ type TestHostConfig,
7
+ type TypeSpecTestLibrary,
8
8
  } from "@typespec/compiler/testing";
9
9
  import { HttpTestLibrary } from "@typespec/http/testing";
10
10
  import { RestTestLibrary } from "@typespec/rest/testing";
@@ -1,5 +1,5 @@
1
- import * as ay from "@alloy-js/core";
2
- import { Type } from "@typespec/compiler";
1
+ import { code } from "@alloy-js/core";
2
+ import type { Type } from "@typespec/compiler";
3
3
  import { TypeExpression } from "./type-expression.js";
4
4
 
5
5
  export interface ArrayExpressionProps {
@@ -7,5 +7,5 @@ export interface ArrayExpressionProps {
7
7
  }
8
8
 
9
9
  export function ArrayExpression({ elementType }: ArrayExpressionProps) {
10
- return ay.code`Array<${(<TypeExpression type={elementType} />)}>`;
10
+ return code`Array<${(<TypeExpression type={elementType} />)}>`;
11
11
  }
@@ -1,6 +1,6 @@
1
1
  import { splitProps } from "@alloy-js/core";
2
2
  import * as ts from "@alloy-js/typescript";
3
- import { Operation } from "@typespec/compiler";
3
+ import type { Operation } from "@typespec/compiler";
4
4
  import { buildParameterDescriptors, getReturnType } from "../utils/operation.js";
5
5
  import { TypeExpression } from "./type-expression.jsx";
6
6
 
@@ -1,5 +1,5 @@
1
1
  import * as ts from "@alloy-js/typescript";
2
- import { Operation } from "@typespec/compiler";
2
+ import type { Operation } from "@typespec/compiler";
3
3
  import { buildParameterDescriptors, getReturnType } from "../utils/operation.js";
4
4
  import { TypeExpression } from "./type-expression.jsx";
5
5
 
@@ -1,6 +1,6 @@
1
- import * as ay from "@alloy-js/core";
1
+ import { type Children, For, type Refkey } from "@alloy-js/core";
2
2
  import * as ts from "@alloy-js/typescript";
3
- import { Enum, EnumMember as TspEnumMember, Union } from "@typespec/compiler";
3
+ import type { Enum, EnumMember as TspEnumMember, Union } from "@typespec/compiler";
4
4
  import { useTsp } from "../../core/context/tsp-context.js";
5
5
  import { reportDiagnostic } from "../../lib.js";
6
6
  import { declarationRefkeys, efRefkey } from "../utils/refkey.js";
@@ -38,7 +38,7 @@ export function EnumDeclaration(props: EnumDeclarationProps) {
38
38
  default={props.default}
39
39
  export={props.export}
40
40
  >
41
- <ay.For each={members} joiner={",\n"}>
41
+ <For each={members} joiner={",\n"}>
42
42
  {([key, value]) => {
43
43
  const memberDoc = $.type.getDoc(value);
44
44
  return (
@@ -51,15 +51,15 @@ export function EnumDeclaration(props: EnumDeclarationProps) {
51
51
  />
52
52
  );
53
53
  }}
54
- </ay.For>
54
+ </For>
55
55
  </ts.EnumDeclaration>
56
56
  );
57
57
  }
58
58
 
59
59
  export interface EnumMemberProps {
60
60
  type: TspEnumMember;
61
- doc?: ay.Children;
62
- refkey?: ay.Refkey;
61
+ doc?: Children;
62
+ refkey?: Refkey;
63
63
  }
64
64
 
65
65
  export function EnumMember(props: EnumMemberProps) {
@@ -1,5 +1,5 @@
1
1
  import * as ts from "@alloy-js/typescript";
2
- import { Model, Operation } from "@typespec/compiler";
2
+ import type { Model, Operation } from "@typespec/compiler";
3
3
  import { useTsp } from "../../core/index.js";
4
4
  import { buildParameterDescriptors, getReturnType } from "../utils/operation.js";
5
5
  import { declarationRefkeys } from "../utils/refkey.js";
@@ -1,6 +1,6 @@
1
1
  import { splitProps } from "@alloy-js/core";
2
2
  import * as ts from "@alloy-js/typescript";
3
- import { Operation } from "@typespec/compiler";
3
+ import type { Operation } from "@typespec/compiler";
4
4
  import { buildParameterDescriptors, getReturnType } from "../utils/operation.js";
5
5
  import { TypeExpression } from "./type-expression.jsx";
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { splitProps } from "@alloy-js/core";
2
2
  import * as ts from "@alloy-js/typescript";
3
- import { Operation } from "@typespec/compiler";
3
+ import type { Operation } from "@typespec/compiler";
4
4
  import { buildParameterDescriptors, getReturnType } from "../utils/operation.js";
5
5
  import { TypeExpression } from "./type-expression.jsx";
6
6
 
@@ -1,15 +1,14 @@
1
- import * as ay from "@alloy-js/core";
2
- import { Children, mapJoin } from "@alloy-js/core";
1
+ import { Block, type Children, For, mapJoin } from "@alloy-js/core";
3
2
  import * as ts from "@alloy-js/typescript";
4
3
  import {
5
- Interface,
4
+ type Interface,
6
5
  isNeverType,
7
- Model,
8
- ModelProperty,
9
- Operation,
10
- RekeyableMap,
6
+ type Model,
7
+ type ModelProperty,
8
+ type Operation,
9
+ type RekeyableMap,
11
10
  } from "@typespec/compiler";
12
- import { Typekit } from "@typespec/compiler/typekit";
11
+ import type { Typekit } from "@typespec/compiler/typekit";
13
12
  import { createRekeyableMap } from "@typespec/compiler/utils";
14
13
  import { useTsp } from "../../core/context/tsp-context.js";
15
14
  import { reportDiagnostic } from "../../lib.js";
@@ -74,9 +73,9 @@ export interface InterfaceExpressionProps extends ts.InterfaceExpressionProps {
74
73
 
75
74
  export function InterfaceExpression(props: InterfaceExpressionProps) {
76
75
  return (
77
- <ay.Block>
76
+ <Block>
78
77
  <InterfaceBody {...props} />
79
- </ay.Block>
78
+ </Block>
80
79
  );
81
80
  }
82
81
 
@@ -156,11 +155,11 @@ function InterfaceBody(props: TypedInterfaceDeclarationProps): Children {
156
155
 
157
156
  return (
158
157
  <>
159
- <ay.For each={validTypeMembers} semicolon line {...enderProp}>
158
+ <For each={validTypeMembers} semicolon line {...enderProp}>
160
159
  {(typeMember) => {
161
160
  return <InterfaceMember type={typeMember} />;
162
161
  }}
163
- </ay.For>
162
+ </For>
164
163
  {props.children}
165
164
  </>
166
165
  );
@@ -1,6 +1,6 @@
1
- import { Children } from "@alloy-js/core";
1
+ import { type Children } from "@alloy-js/core";
2
2
  import * as ts from "@alloy-js/typescript";
3
- import { isNeverType, ModelProperty, Operation } from "@typespec/compiler";
3
+ import { isNeverType, type ModelProperty, type Operation } from "@typespec/compiler";
4
4
  import { getHttpPart } from "@typespec/http";
5
5
  import { useTsp } from "../../core/context/tsp-context.js";
6
6
  import { InterfaceMethod } from "./interface-method.jsx";
@@ -1,6 +1,6 @@
1
- import { Children, splitProps } from "@alloy-js/core";
1
+ import { type Children, splitProps } from "@alloy-js/core";
2
2
  import * as ts from "@alloy-js/typescript";
3
- import { Operation } from "@typespec/compiler";
3
+ import type { Operation } from "@typespec/compiler";
4
4
  import { useTsp } from "../../core/index.js";
5
5
  import { buildParameterDescriptors, getReturnType } from "../utils/operation.js";
6
6
  import { TypeExpression } from "./type-expression.jsx";
@@ -1,5 +1,5 @@
1
1
  import { code } from "@alloy-js/core";
2
- import { Type } from "@typespec/compiler";
2
+ import type { Type } from "@typespec/compiler";
3
3
  import { TypeExpression } from "./type-expression.js";
4
4
 
5
5
  export interface RecordExpressionProps {
@@ -1,5 +1,5 @@
1
1
  import * as ts from "@alloy-js/typescript";
2
- import { Type } from "@typespec/compiler";
2
+ import type { Type } from "@typespec/compiler";
3
3
  import { useTsp } from "../../core/context/tsp-context.js";
4
4
  import { reportDiagnostic } from "../../lib.js";
5
5
  import { declarationRefkeys } from "../utils/refkey.js";