@typespec/emitter-framework 0.8.0-dev.2 → 0.8.0-dev.3

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 (46) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/src/typescript/components/enum-declaration.d.ts +1 -0
  3. package/dist/src/typescript/components/enum-declaration.d.ts.map +1 -1
  4. package/dist/src/typescript/components/enum-declaration.js +7 -0
  5. package/dist/src/typescript/components/function-declaration.d.ts.map +1 -1
  6. package/dist/src/typescript/components/function-declaration.js +8 -3
  7. package/dist/src/typescript/components/interface-declaration.d.ts.map +1 -1
  8. package/dist/src/typescript/components/interface-declaration.js +3 -0
  9. package/dist/src/typescript/components/interface-member.d.ts +3 -1
  10. package/dist/src/typescript/components/interface-member.d.ts.map +1 -1
  11. package/dist/src/typescript/components/interface-member.js +2 -0
  12. package/dist/src/typescript/components/interface-method.d.ts +3 -1
  13. package/dist/src/typescript/components/interface-method.d.ts.map +1 -1
  14. package/dist/src/typescript/components/interface-method.js +9 -2
  15. package/dist/src/typescript/components/type-alias-declaration.d.ts.map +1 -1
  16. package/dist/src/typescript/components/type-alias-declaration.js +4 -1
  17. package/dist/src/typescript/components/type-declaration.d.ts.map +1 -1
  18. package/dist/src/typescript/components/type-declaration.js +10 -0
  19. package/dist/src/typescript/components/union-declaration.d.ts +3 -1
  20. package/dist/src/typescript/components/union-declaration.d.ts.map +1 -1
  21. package/dist/src/typescript/components/union-declaration.js +4 -1
  22. package/dist/src/typescript/components/union-expression.d.ts.map +1 -1
  23. package/dist/src/typescript/components/union-expression.js +103 -10
  24. package/dist/src/typescript/utils/operation.d.ts.map +1 -1
  25. package/dist/src/typescript/utils/operation.js +5 -0
  26. package/dist/test/typescript/components/enum-declaration.test.js +79 -0
  27. package/dist/test/typescript/components/function-declaration.test.js +81 -0
  28. package/dist/test/typescript/components/interface-declaration.test.js +232 -9
  29. package/dist/test/typescript/components/type-alias-declaration.test.js +75 -0
  30. package/dist/test/typescript/components/union-declaration.test.js +358 -106
  31. package/package.json +1 -1
  32. package/src/typescript/components/enum-declaration.tsx +12 -1
  33. package/src/typescript/components/function-declaration.tsx +6 -1
  34. package/src/typescript/components/interface-declaration.tsx +3 -1
  35. package/src/typescript/components/interface-member.tsx +4 -0
  36. package/src/typescript/components/interface-method.tsx +7 -1
  37. package/src/typescript/components/type-alias-declaration.tsx +2 -1
  38. package/src/typescript/components/type-declaration.tsx +8 -6
  39. package/src/typescript/components/union-declaration.tsx +4 -1
  40. package/src/typescript/components/union-expression.tsx +100 -7
  41. package/src/typescript/utils/operation.ts +3 -0
  42. package/test/typescript/components/enum-declaration.test.tsx +72 -0
  43. package/test/typescript/components/function-declaration.test.tsx +78 -0
  44. package/test/typescript/components/interface-declaration.test.tsx +223 -9
  45. package/test/typescript/components/type-alias-declaration.test.tsx +72 -0
  46. package/test/typescript/components/union-declaration.test.tsx +330 -102
@@ -1,18 +1,26 @@
1
- import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
1
+ import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
2
2
  import { render } from "@alloy-js/core";
3
+ import { d } from "@alloy-js/core/testing";
3
4
  import { SourceFile } from "@alloy-js/typescript";
4
- import { format } from "prettier";
5
- import { assert, describe, expect, it } from "vitest";
5
+ import { beforeEach, describe, it } from "vitest";
6
6
  import { Output } from "../../../src/core/components/output.js";
7
7
  import { UnionDeclaration } from "../../../src/typescript/components/union-declaration.js";
8
8
  import { UnionExpression } from "../../../src/typescript/components/union-expression.js";
9
- import { getProgram } from "../test-host.js";
9
+ import { InterfaceDeclaration } from "../../../src/typescript/index.js";
10
+ import { assertFileContents } from "../../utils.js";
11
+ import { createEmitterFrameworkTestRunner } from "../test-host.js";
10
12
  describe("Typescript Union Declaration", () => {
13
+ let runner;
14
+ beforeEach(async () => {
15
+ runner = await createEmitterFrameworkTestRunner();
16
+ });
11
17
  describe("Union not bound to Typespec Types", () => {
12
18
  it("creates a union declaration", async () => {
13
- const program = await getProgram("");
19
+ await runner.compile(``);
14
20
  const res = render(_$createComponent(Output, {
15
- program: program,
21
+ get program() {
22
+ return runner.program;
23
+ },
16
24
  get children() {
17
25
  return _$createComponent(SourceFile, {
18
26
  path: "test.ts",
@@ -25,188 +33,432 @@ describe("Typescript Union Declaration", () => {
25
33
  });
26
34
  }
27
35
  }));
28
- const testFile = res.contents.find(file => file.path === "test.ts");
29
- assert(testFile, "test.ts file not rendered");
30
- const actualContent = await format(testFile.contents, {
31
- parser: "typescript"
32
- });
33
- const expectedContent = await format(`type MyUnion = "red" | "blue"`, {
34
- parser: "typescript"
35
- });
36
- expect(actualContent).toBe(expectedContent);
36
+ assertFileContents(res, d`
37
+ type MyUnion = "red" | "blue";
38
+ `);
37
39
  });
38
40
  });
39
41
  describe("Union bound to Typespec Types", () => {
40
42
  describe("Bound to Union", () => {
41
43
  it("creates a union declaration", async () => {
42
- const program = await getProgram(`
43
- namespace DemoService;
44
- union TestUnion {
45
- one: "one",
46
- two: "two"
47
- }
44
+ const {
45
+ TestUnion
46
+ } = await runner.compile(`
47
+ namespace DemoService;
48
+ @test union TestUnion {
49
+ one: "one",
50
+ two: "two"
51
+ }
48
52
  `);
49
- const [namespace] = program.resolveTypeReference("DemoService");
50
- const union = Array.from(namespace.unions.values())[0];
51
53
  const res = render(_$createComponent(Output, {
52
- program: program,
54
+ get program() {
55
+ return runner.program;
56
+ },
53
57
  get children() {
54
58
  return _$createComponent(SourceFile, {
55
59
  path: "test.ts",
56
60
  get children() {
57
61
  return _$createComponent(UnionDeclaration, {
58
- type: union
62
+ type: TestUnion
59
63
  });
60
64
  }
61
65
  });
62
66
  }
63
67
  }));
64
- const testFile = res.contents.find(file => file.path === "test.ts");
65
- assert(testFile, "test.ts file not rendered");
66
- const actualContent = await format(testFile.contents, {
67
- parser: "typescript"
68
- });
69
- const expectedContent = await format(`type TestUnion = "one" | "two"`, {
70
- parser: "typescript"
71
- });
72
- expect(actualContent).toBe(expectedContent);
68
+ assertFileContents(res, d`
69
+ type TestUnion = "one" | "two";
70
+ `);
71
+ });
72
+ it("creates a union declaration with JSDoc", async () => {
73
+ const {
74
+ TestUnion
75
+ } = await runner.compile(`
76
+ namespace DemoService;
77
+ /**
78
+ * Test Union
79
+ */
80
+ @test union TestUnion {
81
+ one: "one",
82
+ two: "two"
83
+ }
84
+ `);
85
+ const res = render(_$createComponent(Output, {
86
+ get program() {
87
+ return runner.program;
88
+ },
89
+ get children() {
90
+ return _$createComponent(SourceFile, {
91
+ path: "test.ts",
92
+ get children() {
93
+ return _$createComponent(UnionDeclaration, {
94
+ type: TestUnion
95
+ });
96
+ }
97
+ });
98
+ }
99
+ }));
100
+ assertFileContents(res, d`
101
+ /**
102
+ * Test Union
103
+ */
104
+ type TestUnion = "one" | "two";
105
+ `);
73
106
  });
74
107
  it("creates a union declaration with name override", async () => {
75
- const program = await getProgram(`
76
- namespace DemoService;
77
- union TestUnion {
78
- one: "one",
79
- two: "two"
80
- }
108
+ const {
109
+ TestUnion
110
+ } = await runner.compile(`
111
+ namespace DemoService;
112
+ @test union TestUnion {
113
+ one: "one",
114
+ two: "two"
115
+ }
81
116
  `);
82
- const [namespace] = program.resolveTypeReference("DemoService");
83
- const union = Array.from(namespace.unions.values())[0];
84
117
  const res = render(_$createComponent(Output, {
85
- program: program,
118
+ get program() {
119
+ return runner.program;
120
+ },
86
121
  get children() {
87
122
  return _$createComponent(SourceFile, {
88
123
  path: "test.ts",
89
124
  get children() {
90
125
  return _$createComponent(UnionDeclaration, {
91
126
  "export": true,
92
- type: union,
127
+ type: TestUnion,
93
128
  name: "MyUnion"
94
129
  });
95
130
  }
96
131
  });
97
132
  }
98
133
  }));
99
- const testFile = res.contents.find(file => file.path === "test.ts");
100
- assert(testFile, "test.ts file not rendered");
101
- const actualContent = await format(testFile.contents, {
102
- parser: "typescript"
103
- });
104
- const expectedContent = await format(`export type MyUnion = "one" | "two"`, {
105
- parser: "typescript"
106
- });
107
- expect(actualContent).toBe(expectedContent);
134
+ assertFileContents(res, d`
135
+ export type MyUnion = "one" | "two";
136
+ `);
108
137
  });
109
138
  it("creates a union declaration with extra children", async () => {
110
- const program = await getProgram(`
111
- namespace DemoService;
112
- union TestUnion {
113
- one: "one",
114
- two: "two"
115
- }
139
+ const {
140
+ TestUnion
141
+ } = await runner.compile(`
142
+ namespace DemoService;
143
+ @test union TestUnion {
144
+ one: "one",
145
+ two: "two"
146
+ }
116
147
  `);
117
- const [namespace] = program.resolveTypeReference("DemoService");
118
- const union = Array.from(namespace.unions.values())[0];
119
148
  const res = render(_$createComponent(Output, {
120
- program: program,
149
+ get program() {
150
+ return runner.program;
151
+ },
121
152
  get children() {
122
153
  return _$createComponent(SourceFile, {
123
154
  path: "test.ts",
124
155
  get children() {
125
156
  return _$createComponent(UnionDeclaration, {
126
- type: union,
157
+ type: TestUnion,
127
158
  children: "\"three\""
128
159
  });
129
160
  }
130
161
  });
131
162
  }
132
163
  }));
133
- const testFile = res.contents.find(file => file.path === "test.ts");
134
- assert(testFile, "test.ts file not rendered");
135
- const actualContent = await format(testFile.contents, {
136
- parser: "typescript"
137
- });
138
- const expectedContent = await format(`type TestUnion = "one" | "two" | "three"`, {
139
- parser: "typescript"
140
- });
141
- expect(actualContent).toBe(expectedContent);
164
+ assertFileContents(res, d`
165
+ type TestUnion = "one" | "two" | "three";
166
+ `);
142
167
  });
143
- it("renders an union expression", async () => {
144
- const program = await getProgram(`
168
+ it("renders a union expression", async () => {
169
+ const {
170
+ TestUnion
171
+ } = await runner.compile(`
145
172
  namespace DemoService;
146
- union TestUnion {
173
+ @test union TestUnion {
147
174
  one: "one",
148
175
  two: "two"
149
176
  }
150
- `);
151
- const [namespace] = program.resolveTypeReference("DemoService");
152
- const union = Array.from(namespace.unions.values())[0];
177
+ `);
153
178
  const res = render(_$createComponent(Output, {
154
- program: program,
179
+ get program() {
180
+ return runner.program;
181
+ },
155
182
  get children() {
156
183
  return _$createComponent(SourceFile, {
157
184
  path: "test.ts",
158
185
  get children() {
159
186
  return ["let x: ", _$createComponent(UnionExpression, {
160
- type: union
187
+ type: TestUnion
161
188
  }), " = \"one\";"];
162
189
  }
163
190
  });
164
191
  }
165
192
  }));
166
- const testFile = res.contents.find(file => file.path === "test.ts");
167
- assert(testFile, "test.ts file not rendered");
168
- const actualContent = await format(testFile.contents, {
169
- parser: "typescript"
193
+ assertFileContents(res, d`
194
+ let x: "one" | "two" = "one";
195
+ `);
196
+ });
197
+ describe("Discriminated Union", () => {
198
+ it("renders a discriminated union", async () => {
199
+ const {
200
+ TestUnion
201
+ } = await runner.compile(`
202
+ namespace DemoService;
203
+ @discriminated
204
+ @test union TestUnion {
205
+ one: { oneItem: true },
206
+ two: true
207
+ }
208
+ `);
209
+ const res = render(_$createComponent(Output, {
210
+ get program() {
211
+ return runner.program;
212
+ },
213
+ get children() {
214
+ return _$createComponent(SourceFile, {
215
+ path: "test.ts",
216
+ get children() {
217
+ return _$createComponent(UnionDeclaration, {
218
+ type: TestUnion
219
+ });
220
+ }
221
+ });
222
+ }
223
+ }));
224
+ assertFileContents(res, d`
225
+ type TestUnion = {
226
+ kind: "one";
227
+ value: {
228
+ oneItem: true;
229
+ };
230
+ } | {
231
+ kind: "two";
232
+ value: true;
233
+ };
234
+ `);
170
235
  });
171
- const expectedContent = await format(`let x:"one" | "two" = "one"`, {
172
- parser: "typescript"
236
+ });
237
+ it("renders a discriminated union with custom properties", async () => {
238
+ const {
239
+ TestUnion
240
+ } = await runner.compile(`
241
+ namespace DemoService;
242
+ @discriminated(#{ discriminatorPropertyName: "dataKind", envelopePropertyName: "data" })
243
+ @test union TestUnion {
244
+ one: { oneItem: true },
245
+ two: true
246
+ }
247
+ `);
248
+ const res = render(_$createComponent(Output, {
249
+ get program() {
250
+ return runner.program;
251
+ },
252
+ get children() {
253
+ return _$createComponent(SourceFile, {
254
+ path: "test.ts",
255
+ get children() {
256
+ return _$createComponent(UnionDeclaration, {
257
+ type: TestUnion
258
+ });
259
+ }
260
+ });
261
+ }
262
+ }));
263
+ assertFileContents(res, d`
264
+ type TestUnion = {
265
+ dataKind: "one";
266
+ data: {
267
+ oneItem: true;
268
+ };
269
+ } | {
270
+ dataKind: "two";
271
+ data: true;
272
+ };
273
+ `);
274
+ });
275
+ it("renders a discriminated union with named models", async () => {
276
+ const {
277
+ Pet,
278
+ Cat,
279
+ Dog
280
+ } = await runner.compile(`
281
+ namespace DemoService;
282
+ @test model Cat {
283
+ name: string;
284
+ meow: boolean;
285
+ }
286
+
287
+ @test model Dog {
288
+ name: string;
289
+ bark: boolean;
290
+ }
291
+
292
+ @discriminated
293
+ @test union Pet {
294
+ cat: Cat,
295
+ dog: Dog,
296
+ }
297
+ `);
298
+ const res = render(_$createComponent(Output, {
299
+ get program() {
300
+ return runner.program;
301
+ },
302
+ get children() {
303
+ return _$createComponent(SourceFile, {
304
+ path: "test.ts",
305
+ get children() {
306
+ return [_$createComponent(InterfaceDeclaration, {
307
+ type: Cat
308
+ }), _$createIntrinsic("hbr", {}), _$createComponent(InterfaceDeclaration, {
309
+ type: Dog
310
+ }), _$createIntrinsic("hbr", {}), _$createComponent(UnionDeclaration, {
311
+ type: Pet
312
+ })];
313
+ }
314
+ });
315
+ }
316
+ }));
317
+ assertFileContents(res, d`
318
+ interface Cat {
319
+ name: string;
320
+ meow: boolean;
321
+ }
322
+ interface Dog {
323
+ name: string;
324
+ bark: boolean;
325
+ }
326
+ type Pet = {
327
+ kind: "cat";
328
+ value: Cat;
329
+ } | {
330
+ kind: "dog";
331
+ value: Dog;
332
+ };
333
+ `);
334
+ });
335
+ describe("Discriminated Union with no envelope", () => {
336
+ it("renders named discriminated union", async () => {
337
+ const {
338
+ Pet,
339
+ Cat,
340
+ Dog
341
+ } = await runner.compile(`
342
+ namespace DemoService;
343
+
344
+ @test model Cat {
345
+ name: string;
346
+ meow: boolean;
347
+ }
348
+
349
+ @test model Dog {
350
+ name: string;
351
+ bark: boolean;
352
+ }
353
+
354
+ @discriminated(#{ envelope: "none", discriminatorPropertyName: "dataKind" })
355
+ @test union Pet {
356
+ cat: Cat,
357
+ dog: Dog,
358
+ }
359
+ `);
360
+ const res = render(_$createComponent(Output, {
361
+ get program() {
362
+ return runner.program;
363
+ },
364
+ get children() {
365
+ return _$createComponent(SourceFile, {
366
+ path: "test.ts",
367
+ get children() {
368
+ return [_$createComponent(InterfaceDeclaration, {
369
+ type: Cat
370
+ }), _$createIntrinsic("hbr", {}), _$createComponent(InterfaceDeclaration, {
371
+ type: Dog
372
+ }), _$createIntrinsic("hbr", {}), _$createComponent(UnionDeclaration, {
373
+ type: Pet
374
+ })];
375
+ }
376
+ });
377
+ }
378
+ }));
379
+ assertFileContents(res, d`
380
+ interface Cat {
381
+ name: string;
382
+ meow: boolean;
383
+ }
384
+ interface Dog {
385
+ name: string;
386
+ bark: boolean;
387
+ }
388
+ type Pet = {
389
+ dataKind: "cat"
390
+ } & Cat | {
391
+ dataKind: "dog"
392
+ } & Dog;
393
+ `);
394
+ });
395
+ it("renders anonymous discriminated union", async () => {
396
+ const {
397
+ TestUnion
398
+ } = await runner.compile(`
399
+ namespace DemoService;
400
+ @discriminated(#{ envelope: "none", discriminatorPropertyName: "dataKind" })
401
+ @test union TestUnion {
402
+ one: { oneItem: true },
403
+ two: { secondItem: false }
404
+ }
405
+ `);
406
+ const res = render(_$createComponent(Output, {
407
+ get program() {
408
+ return runner.program;
409
+ },
410
+ get children() {
411
+ return _$createComponent(SourceFile, {
412
+ path: "test.ts",
413
+ get children() {
414
+ return _$createComponent(UnionDeclaration, {
415
+ type: TestUnion
416
+ });
417
+ }
418
+ });
419
+ }
420
+ }));
421
+ assertFileContents(res, d`
422
+ type TestUnion = {
423
+ dataKind: "one";
424
+ oneItem: true;
425
+ } | {
426
+ dataKind: "two";
427
+ secondItem: false;
428
+ };
429
+ `);
173
430
  });
174
- expect(actualContent).toBe(expectedContent);
175
431
  });
176
432
  });
177
433
  describe("Bound to Enum", () => {
178
434
  it("creates a union declaration", async () => {
179
- const program = await getProgram(`
180
- namespace DemoService;
181
- enum TestEnum {
182
- one: "one",
183
- two: "two"
184
- }
435
+ const {
436
+ TestEnum
437
+ } = await runner.compile(`
438
+ namespace DemoService;
439
+ @test enum TestEnum {
440
+ one: "one",
441
+ two: "two"
442
+ }
185
443
  `);
186
- const [namespace] = program.resolveTypeReference("DemoService");
187
- const union = Array.from(namespace.enums.values())[0];
188
444
  const res = render(_$createComponent(Output, {
189
- program: program,
445
+ get program() {
446
+ return runner.program;
447
+ },
190
448
  get children() {
191
449
  return _$createComponent(SourceFile, {
192
450
  path: "test.ts",
193
451
  get children() {
194
452
  return _$createComponent(UnionDeclaration, {
195
- type: union
453
+ type: TestEnum
196
454
  });
197
455
  }
198
456
  });
199
457
  }
200
458
  }));
201
- const testFile = res.contents.find(file => file.path === "test.ts");
202
- assert(testFile, "test.ts file not rendered");
203
- const actualContent = await format(testFile.contents, {
204
- parser: "typescript"
205
- });
206
- const expectedContent = await format(`type TestEnum = "one" | "two"`, {
207
- parser: "typescript"
208
- });
209
- expect(actualContent).toBe(expectedContent);
459
+ assertFileContents(res, d`
460
+ type TestEnum = "one" | "two";
461
+ `);
210
462
  });
211
463
  });
212
464
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/emitter-framework",
3
- "version": "0.8.0-dev.2",
3
+ "version": "0.8.0-dev.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -28,13 +28,22 @@ export function EnumDeclaration(props: EnumDeclarationProps) {
28
28
  const refkeys = declarationRefkeys(props.refkey, props.type);
29
29
  const name = props.name ?? ts.useTSNamePolicy().getName(props.type.name!, "enum");
30
30
  const members = Array.from(type.members.entries());
31
+ const doc = props.doc ?? $.type.getDoc(type);
31
32
 
32
33
  return (
33
- <ts.EnumDeclaration name={name} refkey={refkeys} default={props.default} export={props.export}>
34
+ <ts.EnumDeclaration
35
+ doc={doc}
36
+ name={name}
37
+ refkey={refkeys}
38
+ default={props.default}
39
+ export={props.export}
40
+ >
34
41
  <ay.For each={members} joiner={",\n"}>
35
42
  {([key, value]) => {
43
+ const memberDoc = $.type.getDoc(value);
36
44
  return (
37
45
  <EnumMember
46
+ doc={memberDoc}
38
47
  type={value}
39
48
  refkey={
40
49
  $.union.is(props.type) ? efRefkey(props.type.variants.get(key)) : efRefkey(value)
@@ -49,12 +58,14 @@ export function EnumDeclaration(props: EnumDeclarationProps) {
49
58
 
50
59
  export interface EnumMemberProps {
51
60
  type: TspEnumMember;
61
+ doc?: ay.Children;
52
62
  refkey?: ay.Refkey;
53
63
  }
54
64
 
55
65
  export function EnumMember(props: EnumMemberProps) {
56
66
  return (
57
67
  <ts.EnumMember
68
+ doc={props.doc}
58
69
  name={props.type.name}
59
70
  jsValue={props.type.value ?? props.type.name}
60
71
  refkey={props.refkey}
@@ -1,5 +1,6 @@
1
1
  import * as ts from "@alloy-js/typescript";
2
2
  import { Model, Operation } from "@typespec/compiler";
3
+ import { useTsp } from "../../core/index.js";
3
4
  import { buildParameterDescriptors, getReturnType } from "../utils/operation.js";
4
5
  import { declarationRefkeys } from "../utils/refkey.js";
5
6
  import { TypeExpression } from "./type-expression.js";
@@ -21,6 +22,8 @@ export type FunctionDeclarationProps =
21
22
  * provided will take precedence.
22
23
  */
23
24
  export function FunctionDeclaration(props: FunctionDeclarationProps) {
25
+ const { $ } = useTsp();
26
+
24
27
  if (!isTypedFunctionDeclarationProps(props)) {
25
28
  return <ts.FunctionDeclaration {...props} />;
26
29
  }
@@ -40,8 +43,10 @@ export function FunctionDeclaration(props: FunctionDeclarationProps) {
40
43
  params: props.parameters,
41
44
  mode: props.parametersMode,
42
45
  });
46
+ const doc = props.doc ?? $.type.getDoc(props.type);
43
47
  return (
44
48
  <ts.FunctionDeclaration
49
+ doc={doc}
45
50
  refkey={refkeys}
46
51
  name={name}
47
52
  async={props.async}
@@ -49,8 +54,8 @@ export function FunctionDeclaration(props: FunctionDeclarationProps) {
49
54
  export={props.export}
50
55
  kind={props.kind}
51
56
  returnType={returnType}
57
+ parameters={allParameters}
52
58
  >
53
- <ts.FunctionDeclaration.Parameters parameters={allParameters} />
54
59
  {props.children}
55
60
  </ts.FunctionDeclaration>
56
61
  );
@@ -45,9 +45,11 @@ export function InterfaceDeclaration(props: InterfaceDeclarationProps) {
45
45
  const refkeys = declarationRefkeys(props.refkey, props.type);
46
46
 
47
47
  const extendsType = props.extends ?? getExtendsType($, props.type);
48
+ const doc = props.doc ?? $.type.getDoc(props.type);
48
49
 
49
50
  return (
50
51
  <ts.InterfaceDeclaration
52
+ doc={doc}
51
53
  default={props.default}
52
54
  export={props.export}
53
55
  kind={props.kind}
@@ -154,7 +156,7 @@ function InterfaceBody(props: TypedInterfaceDeclarationProps): Children {
154
156
 
155
157
  return (
156
158
  <>
157
- <ay.For each={validTypeMembers} line {...enderProp}>
159
+ <ay.For each={validTypeMembers} semicolon line {...enderProp}>
158
160
  {(typeMember) => {
159
161
  return <InterfaceMember type={typeMember} />;
160
162
  }}