@typespec/emitter-framework 0.17.1-dev.2 → 0.18.1-dev.0

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 (36) hide show
  1. package/.turbo/turbo-build.log +6 -0
  2. package/CHANGELOG.md +8 -0
  3. package/dist/src/csharp/components/enum/declaration.js +3 -0
  4. package/dist/src/csharp/components/enum/declaration.js.map +1 -1
  5. package/dist/src/csharp/components/enum/declaration.test.js +28 -1
  6. package/dist/src/csharp/components/enum/declaration.test.js.map +1 -1
  7. package/dist/src/csharp/components/index.d.ts +1 -0
  8. package/dist/src/csharp/components/index.d.ts.map +1 -1
  9. package/dist/src/csharp/components/index.js +1 -0
  10. package/dist/src/csharp/components/index.js.map +1 -1
  11. package/dist/src/csharp/components/utils/index.d.ts +4 -0
  12. package/dist/src/csharp/components/utils/index.d.ts.map +1 -0
  13. package/dist/src/csharp/components/utils/index.js +4 -0
  14. package/dist/src/csharp/components/utils/index.js.map +1 -0
  15. package/dist/src/python/components/class-declaration/class-declaration.test.js +65 -17
  16. package/dist/src/python/components/class-declaration/class-declaration.test.js.map +1 -1
  17. package/dist/src/python/components/class-declaration/class-member.test.js +16 -4
  18. package/dist/src/python/components/class-declaration/class-member.test.js.map +1 -1
  19. package/dist/src/python/components/function-declaration/function-declaration.test.js +4 -1
  20. package/dist/src/python/components/function-declaration/function-declaration.test.js.map +1 -1
  21. package/dist/src/python/components/type-alias-declaration/type-alias-declaration.test.js +28 -7
  22. package/dist/src/python/components/type-alias-declaration/type-alias-declaration.test.js.map +1 -1
  23. package/dist/src/python/components/type-declaration/type-declaration.test.js +8 -2
  24. package/dist/src/python/components/type-declaration/type-declaration.test.js.map +1 -1
  25. package/package.json +17 -17
  26. package/package.json.bak +8 -3
  27. package/src/csharp/components/enum/declaration.test.tsx +26 -1
  28. package/src/csharp/components/enum/declaration.tsx +1 -1
  29. package/src/csharp/components/index.ts +1 -0
  30. package/src/csharp/components/utils/index.ts +3 -0
  31. package/src/python/components/class-declaration/class-declaration.test.tsx +65 -17
  32. package/src/python/components/class-declaration/class-member.test.tsx +16 -4
  33. package/src/python/components/function-declaration/function-declaration.test.tsx +4 -1
  34. package/src/python/components/type-alias-declaration/type-alias-declaration.test.tsx +28 -7
  35. package/src/python/components/type-declaration/type-declaration.test.tsx +8 -2
  36. package/vitest.config.ts +0 -4
@@ -18,7 +18,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
18
18
  type: MyDate
19
19
  })])).toRenderTo(`
20
20
  from datetime import datetime
21
- from typing import TypeAlias
21
+ from typing import TYPE_CHECKING
22
+
23
+ if TYPE_CHECKING:
24
+ from typing import TypeAlias
22
25
 
23
26
 
24
27
  my_date: TypeAlias = datetime`);
@@ -37,7 +40,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
37
40
  type: MyDate
38
41
  })])).toRenderTo(`
39
42
  from datetime import datetime
40
- from typing import TypeAlias
43
+ from typing import TYPE_CHECKING
44
+
45
+ if TYPE_CHECKING:
46
+ from typing import TypeAlias
41
47
 
42
48
 
43
49
  # Type to represent a date
@@ -58,7 +64,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
58
64
  type: MyDate
59
65
  })])).toRenderTo(`
60
66
  from datetime import datetime
61
- from typing import TypeAlias
67
+ from typing import TYPE_CHECKING
68
+
69
+ if TYPE_CHECKING:
70
+ from typing import TypeAlias
62
71
 
63
72
 
64
73
  # Overridden Doc
@@ -76,7 +85,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
76
85
  type: MyDate
77
86
  })])).toRenderTo(`
78
87
  from datetime import datetime
79
- from typing import TypeAlias
88
+ from typing import TYPE_CHECKING
89
+
90
+ if TYPE_CHECKING:
91
+ from typing import TypeAlias
80
92
 
81
93
 
82
94
  my_date: TypeAlias = datetime`);
@@ -93,7 +105,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
93
105
  type: MyDate
94
106
  })])).toRenderTo(`
95
107
  from datetime import datetime
96
- from typing import TypeAlias
108
+ from typing import TYPE_CHECKING
109
+
110
+ if TYPE_CHECKING:
111
+ from typing import TypeAlias
97
112
 
98
113
 
99
114
  my_date: TypeAlias = datetime`);
@@ -110,7 +125,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
110
125
  type: MyDate
111
126
  })])).toRenderTo(`
112
127
  from datetime import datetime
113
- from typing import TypeAlias
128
+ from typing import TYPE_CHECKING
129
+
130
+ if TYPE_CHECKING:
131
+ from typing import TypeAlias
114
132
 
115
133
 
116
134
  my_date: TypeAlias = datetime`);
@@ -130,7 +148,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
130
148
  type: Handler
131
149
  })])).toRenderTo(`
132
150
  from typing import Callable
133
- from typing import TypeAlias
151
+ from typing import TYPE_CHECKING
152
+
153
+ if TYPE_CHECKING:
154
+ from typing import TypeAlias
134
155
 
135
156
 
136
157
  handle_request: TypeAlias = Callable[[str], str]`);
@@ -1 +1 @@
1
- {"version":3,"names":["Tester","t","describe","expect","it","getOutput","TypeAliasDeclaration","program","MyDate","compile","code","scalar","_$createComponent","type","toRenderTo","doc","Handler"],"sources":["../../../../../src/python/components/type-alias-declaration/type-alias-declaration.test.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,CAAC,QAAQ,4BAA4B;AAC9C,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,oBAAoB,QAAQ,6BAA6B;AAElEJ,QAAQ,CAAC,8CAA8C,EAAE,MAAM;EAC7DA,QAAQ,CAAC,iDAAiD,EAAE,MAAM;IAChEA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;MAC3CE,EAAE,CAAC,qEAAqE,EAAE,YAAY;QACpF,MAAM;UAAEG,OAAO;UAAEC;QAAO,CAAC,GAAG,MAAMR,MAAM,CAACS,OAAO,CAACR,CAAC,CAACS,IAAI;AAC/D,mBAAmBT,CAAC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Y;MACrE,MAAM;QAAEG,OAAO;QAAES;MAAQ,CAAC,GAAG,MAAMhB,MAAM,CAACS,OAAO,CAACR,CAAC,CAACS,IAAI;AAC9D;AACA,gBAAgBT,CAAC,CAACY,IAAI,CAAC,SAAS,CAAC;AACjC,OAAO,CAAC;MAEFV,MAAM,CAACE,SAAS,CAACE,OAAO,EAAE,CAAAK,iBAAA,CAAEN,oBAAoB;QAACO,IAAI,EAAEG;MAAO,GAAK,CAAC,CAAC,CAACF,UAAU,CAAC;AACvF;AACA;AACA;AACA;AACA,yDAAyD,CAAC;IACtD,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Tester","t","describe","expect","it","getOutput","TypeAliasDeclaration","program","MyDate","compile","code","scalar","_$createComponent","type","toRenderTo","doc","Handler"],"sources":["../../../../../src/python/components/type-alias-declaration/type-alias-declaration.test.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,CAAC,QAAQ,4BAA4B;AAC9C,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,oBAAoB,QAAQ,6BAA6B;AAElEJ,QAAQ,CAAC,8CAA8C,EAAE,MAAM;EAC7DA,QAAQ,CAAC,iDAAiD,EAAE,MAAM;IAChEA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;MAC3CE,EAAE,CAAC,qEAAqE,EAAE,YAAY;QACpF,MAAM;UAAEG,OAAO;UAAEC;QAAO,CAAC,GAAG,MAAMR,MAAM,CAACS,OAAO,CAACR,CAAC,CAACS,IAAI;AAC/D,mBAAmBT,CAAC,CAACU,MAAM,CAAC,QAAQ,CAAC;AACrC,SAAS,CAAC;QAEFR,MAAM,CAACE,SAAS,CAACE,OAAO,EAAE,CAAAK,iBAAA,CAAEN,oBAAoB;UAACO,IAAI,EAAEL;QAAM,G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AM,CAACS,OAAO,CAACR,CAAC,CAACS,IAAI;AAC9D;AACA,gBAAgBT,CAAC,CAACY,IAAI,CAAC,SAAS,CAAC;AACjC,OAAO,CAAC;MAEFV,MAAM,CAACE,SAAS,CAACE,OAAO,EAAE,CAAAK,iBAAA,CAAEN,oBAAoB;QAACO,IAAI,EAAEG;MAAO,GAAK,CAAC,CAAC,CAACF,UAAU,CAAC;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,CAAC;IACtD,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -44,7 +44,10 @@ describe("Python TypeDeclaration dispatcher", () => {
44
44
  })]);
45
45
  expect(output).toRenderTo(d`
46
46
  from datetime import datetime
47
- from typing import TypeAlias
47
+ from typing import TYPE_CHECKING
48
+
49
+ if TYPE_CHECKING:
50
+ from typing import TypeAlias
48
51
 
49
52
 
50
53
  my_date: TypeAlias = datetime`);
@@ -60,7 +63,10 @@ describe("Python TypeDeclaration dispatcher", () => {
60
63
  type: Items
61
64
  })]);
62
65
  expect(output).toRenderTo(d`
63
- from typing import TypeAlias
66
+ from typing import TYPE_CHECKING
67
+
68
+ if TYPE_CHECKING:
69
+ from typing import TypeAlias
64
70
 
65
71
 
66
72
  items: TypeAlias = list[int]`);
@@ -1 +1 @@
1
- {"version":3,"names":["Tester","d","t","describe","expect","it","getOutput","TypeDeclaration","program","Foo","compile","code","enum","output","_$createComponent","type","toRenderTo","MyDate","scalar","Items","model"],"sources":["../../../../../src/python/components/type-declaration/type-declaration.test.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,CAAC,QAAQ,wBAAwB;AAC1C,SAASC,CAAC,QAAQ,4BAA4B;AAC9C,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,eAAe,QAAQ,uBAAuB;AA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iBAAA,CAAEP,eAAe;MAACQ,IAAI,EAAEI;IAAK,GAAK,CAAC;IACrEf,MAAM,CAACS,MAAM,CAAC,CAACG,UAAU,CAACf,CAAC;AAC/B;AACA;AACA;AACA,mCAAmC,CAAC;EAClC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Tester","d","t","describe","expect","it","getOutput","TypeDeclaration","program","Foo","compile","code","enum","output","_$createComponent","type","toRenderTo","MyDate","scalar","Items","model"],"sources":["../../../../../src/python/components/type-declaration/type-declaration.test.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,CAAC,QAAQ,wBAAwB;AAC1C,SAASC,CAAC,QAAQ,4BAA4B;AAC9C,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,eAAe,QAAQ,uBAAuB;AAEvDJ,QAAQ,CAAC,mCAAmC,EAAE,MAAM;EAClDE,EAAE,CAAC,yCAAyC,EAAE,YAAY;IACxD,MAAM;MAAEG,OAAO;MAAEC;IAAI,CAAC,GAAG,MAAMT,MAAM,CAACU,OAAO,CAACR,CAAC,CAACS,IAAI;AACxD,aAAaT,CAAC,CAACU,IAAI,CAAC,KAAK,CAAC;AAC1B;AACA;AACA;AACA;AACA,KAAK,CAAC;IAEF,MAAMC,MAAM,GAAGP,SAAS,CAACE,OAAO,EAAE,CAAAM,iBAAA,CAAEP,eAAe;MAACQ,IAAI,EAAEN;IAAG,GAAK,CAAC;IACnEL,MAAM,CAACS,MAAM,CAAC,CAACG,UAAU,CAACf,CAAC;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFI,EAAE,CAAC,4CAA4C,EAAE,YAAY;IAC3D,MAAM;MAAEG,OAAO;MAAES;IAAO,CAAC,GAAG,MAAMjB,MAAM,CAACU,OAAO,CAACR,CAAC,CAACS,IAAI;AAC3D,eAAeT,CAAC,CAACgB,MAAM,CAAC,QAAQ,CAAC;AACjC,KAAK,CAAC;IAEF,MAAML,MAAM,GAAGP,SAAS,CAACE,OAAO,EAAE,CAAAM,iBAAA,CAAEP,eAAe;MAACQ,IAAI,EAAEE;IAAM,GAAK,CAAC;IACtEb,MAAM,CAACS,MAAM,CAAC,CAACG,UAAU,CAACf,CAAC;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,CAAC;EACnC,CAAC,CAAC;EAEFI,EAAE,CAAC,kEAAkE,EAAE,YAAY;IACjF,MAAM;MAAEG,OAAO;MAAEW;IAAM,CAAC,GAAG,MAAMnB,MAAM,CAACU,OAAO,CAACR,CAAC,CAACS,IAAI;AAC1D,cAAcT,CAAC,CAACkB,KAAK,CAAC,OAAO,CAAC;AAC9B,KAAK,CAAC;IAEF,MAAMP,MAAM,GAAGP,SAAS,CAACE,OAAO,EAAE,CAAAM,iBAAA,CAAEP,eAAe;MAACQ,IAAI,EAAEI;IAAK,GAAK,CAAC;IACrEf,MAAM,CAACS,MAAM,CAAC,CAACG,UAAU,CAACf,CAAC;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,CAAC;EAClC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/emitter-framework",
3
- "version": "0.17.1-dev.2",
3
+ "version": "0.18.1-dev.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -44,30 +44,30 @@
44
44
  "license": "MIT",
45
45
  "description": "",
46
46
  "peerDependencies": {
47
- "@alloy-js/core": "^0.22.0",
48
- "@alloy-js/csharp": "^0.22.0",
49
- "@alloy-js/python": "^0.3.0",
50
- "@alloy-js/typescript": "^0.22.0",
51
- "@typespec/compiler": "^1.10.0 || >= 1.11.0-dev.6"
47
+ "@alloy-js/core": "^0.23.0",
48
+ "@alloy-js/csharp": "^0.23.0",
49
+ "@alloy-js/python": "^0.4.0",
50
+ "@alloy-js/typescript": "^0.23.0",
51
+ "@typespec/compiler": "^1.13.0 || >= 1.14.0-dev.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@alloy-js/cli": "^0.22.0",
55
- "@alloy-js/core": "^0.22.0",
56
- "@alloy-js/python": "^0.3.0",
57
- "@alloy-js/rollup-plugin": "^0.1.0",
58
- "@alloy-js/typescript": "^0.22.0",
59
- "@typespec/compiler": "^1.10.0 || >= 1.11.0-dev.6",
60
- "concurrently": "^9.2.1",
54
+ "@alloy-js/cli": "^0.23.0",
55
+ "@alloy-js/core": "^0.23.0",
56
+ "@alloy-js/python": "^0.4.0",
57
+ "@alloy-js/rollup-plugin": "^0.1.1",
58
+ "@alloy-js/typescript": "^0.23.0",
59
+ "@typespec/compiler": "^1.13.0 || >= 1.14.0-dev.0",
60
+ "concurrently": "^10.0.0",
61
61
  "pathe": "^2.0.3",
62
- "prettier": "~3.8.1",
62
+ "prettier": "^3.8.1",
63
63
  "tree-sitter-c-sharp": "^0.23.1",
64
64
  "tree-sitter-java": "^0.23.5",
65
65
  "tree-sitter-javascript": "^0.25.0",
66
66
  "tree-sitter-python": "^0.25.0",
67
67
  "tree-sitter-typescript": "^0.23.2",
68
- "typescript": "~5.9.3",
69
- "vitest": "^4.1.0",
70
- "web-tree-sitter": "^0.26.7"
68
+ "typescript": "~6.0.2",
69
+ "vitest": "^4.1.3",
70
+ "web-tree-sitter": "^0.26.8"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "alloy build",
package/package.json.bak CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typespec/emitter-framework",
3
- "version": "0.17.1-dev.2",
3
+ "version": "0.18.1-dev.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -23,18 +23,23 @@
23
23
  },
24
24
  "exports": {
25
25
  ".": {
26
+ "development": "./src/core/index.ts",
26
27
  "import": "./dist/src/core/index.js"
27
28
  },
28
29
  "./csharp": {
30
+ "development": "./src/csharp/index.ts",
29
31
  "import": "./dist/src/csharp/index.js"
30
32
  },
31
33
  "./typescript": {
34
+ "development": "./src/typescript/index.ts",
32
35
  "import": "./dist/src/typescript/index.js"
33
36
  },
34
37
  "./python": {
38
+ "development": "./src/python/index.ts",
35
39
  "import": "./dist/src/python/index.js"
36
40
  },
37
41
  "./testing": {
42
+ "development": "./src/testing/index.ts",
38
43
  "import": "./dist/src/testing/index.js"
39
44
  }
40
45
  },
@@ -66,7 +71,7 @@
66
71
  "@alloy-js/csharp": "catalog:",
67
72
  "@alloy-js/python": "catalog:",
68
73
  "@alloy-js/typescript": "catalog:",
69
- "@typespec/compiler": "^1.10.0 || >= 1.11.0-dev.6"
74
+ "@typespec/compiler": "^1.13.0 || >= 1.14.0-dev.0"
70
75
  },
71
76
  "devDependencies": {
72
77
  "@alloy-js/cli": "catalog:",
@@ -74,7 +79,7 @@
74
79
  "@alloy-js/python": "catalog:",
75
80
  "@alloy-js/rollup-plugin": "catalog:",
76
81
  "@alloy-js/typescript": "catalog:",
77
- "@typespec/compiler": "^1.10.0 || >= 1.11.0-dev.6",
82
+ "@typespec/compiler": "^1.13.0 || >= 1.14.0-dev.0",
78
83
  "concurrently": "catalog:",
79
84
  "pathe": "catalog:",
80
85
  "prettier": "catalog:",
@@ -203,7 +203,7 @@ it("renders multiple enums in the same namespace", async () => {
203
203
  `);
204
204
  });
205
205
 
206
- it("renders an enum with doc comments", async () => {
206
+ it("renders an enum with member doc comments", async () => {
207
207
  const { TestEnum } = await runner.compile(t.code`
208
208
  @test enum ${t.enum("TestEnum")} {
209
209
  @doc("This is value one")
@@ -231,3 +231,28 @@ it("renders an enum with doc comments", async () => {
231
231
  }
232
232
  `);
233
233
  });
234
+
235
+ it("renders an enum with a type-level doc comment", async () => {
236
+ const { TestEnum } = await runner.compile(t.code`
237
+ /** Represents available colors */
238
+ @test enum ${t.enum("TestEnum")} {
239
+ Value1;
240
+ Value2;
241
+ }
242
+ `);
243
+
244
+ expect(
245
+ <Wrapper>
246
+ <EnumDeclaration type={TestEnum} />
247
+ </Wrapper>,
248
+ ).toRenderTo(`
249
+ /// <summary>
250
+ /// Represents available colors
251
+ /// </summary>
252
+ enum TestEnum
253
+ {
254
+ Value1,
255
+ Value2
256
+ }
257
+ `);
258
+ });
@@ -32,7 +32,7 @@ export function EnumDeclaration(props: EnumDeclarationProps): Children {
32
32
 
33
33
  return (
34
34
  <>
35
- <cs.EnumDeclaration name={name} refkey={refkeys} {...props}>
35
+ <cs.EnumDeclaration name={name} refkey={refkeys} {...props} doc={getDocComments($, type)}>
36
36
  <For each={members} joiner={",\n"}>
37
37
  {([key, value]) => {
38
38
  return (
@@ -5,3 +5,4 @@ export * from "./json-converter/json-converter-resolver.jsx";
5
5
  export * from "./json-converter/json-converter.jsx";
6
6
  export * from "./property/property.jsx";
7
7
  export * from "./type-expression.jsx";
8
+ export * from "./utils/index.js";
@@ -0,0 +1,3 @@
1
+ export { getDocComments } from "./doc-comments.jsx";
2
+ export { getNullableUnionInnerType } from "./nullable-util.js";
3
+ export { declarationRefkeys, efRefkey } from "./refkey.js";
@@ -32,8 +32,11 @@ describe("Python Class from model", () => {
32
32
  expect(getOutput(program, [<ClassDeclaration type={Widget} />])).toRenderTo(
33
33
  `
34
34
  from dataclasses import dataclass
35
- from typing import Literal
36
- from typing import Optional
35
+ from typing import TYPE_CHECKING
36
+
37
+ if TYPE_CHECKING:
38
+ from typing import Literal
39
+ from typing import Optional
37
40
 
38
41
 
39
42
  @dataclass(kw_only=True)
@@ -67,7 +70,10 @@ describe("Python Class from model", () => {
67
70
  expect(getOutput(program, [<ClassDeclaration type={Widget} />])).toRenderTo(
68
71
  `
69
72
  from dataclasses import dataclass
70
- from typing import Optional
73
+ from typing import TYPE_CHECKING
74
+
75
+ if TYPE_CHECKING:
76
+ from typing import Optional
71
77
 
72
78
 
73
79
  @dataclass(kw_only=True)
@@ -91,7 +97,10 @@ describe("Python Class from model", () => {
91
97
  expect(getOutput(program, [<ClassDeclaration type={Widget} />])).toRenderTo(
92
98
  `
93
99
  from dataclasses import dataclass
94
- from typing import Optional
100
+ from typing import TYPE_CHECKING
101
+
102
+ if TYPE_CHECKING:
103
+ from typing import Optional
95
104
 
96
105
 
97
106
  @dataclass(kw_only=True)
@@ -369,7 +378,10 @@ describe("Python Class from model", () => {
369
378
  `
370
379
  from dataclasses import dataclass
371
380
  from enum import StrEnum
372
- from typing import Literal
381
+ from typing import TYPE_CHECKING
382
+
383
+ if TYPE_CHECKING:
384
+ from typing import Literal
373
385
 
374
386
 
375
387
  class Color(StrEnum):
@@ -407,7 +419,10 @@ describe("Python Class from model", () => {
407
419
  `
408
420
  from dataclasses import dataclass
409
421
  from enum import StrEnum
410
- from typing import Literal
422
+ from typing import TYPE_CHECKING
423
+
424
+ if TYPE_CHECKING:
425
+ from typing import Literal
411
426
 
412
427
 
413
428
  class Color(StrEnum):
@@ -436,7 +451,10 @@ describe("Python Class from model", () => {
436
451
  expect(getOutput(program, [<ClassDeclaration type={Widget} />])).toRenderTo(
437
452
  `
438
453
  from dataclasses import dataclass
439
- from typing import Literal
454
+ from typing import TYPE_CHECKING
455
+
456
+ if TYPE_CHECKING:
457
+ from typing import Literal
440
458
 
441
459
 
442
460
  @dataclass(kw_only=True)
@@ -459,7 +477,10 @@ describe("Python Class from model", () => {
459
477
  expect(getOutput(program, [<ClassDeclaration type={Widget} />])).toRenderTo(
460
478
  `
461
479
  from dataclasses import dataclass
462
- from typing import Literal
480
+ from typing import TYPE_CHECKING
481
+
482
+ if TYPE_CHECKING:
483
+ from typing import Literal
463
484
 
464
485
 
465
486
  @dataclass(kw_only=True)
@@ -490,7 +511,10 @@ describe("Python Class from model", () => {
490
511
  `
491
512
  from dataclasses import dataclass
492
513
  from enum import StrEnum
493
- from typing import Literal
514
+ from typing import TYPE_CHECKING
515
+
516
+ if TYPE_CHECKING:
517
+ from typing import Literal
494
518
 
495
519
 
496
520
  class Color(StrEnum):
@@ -516,7 +540,10 @@ describe("Python Class from model", () => {
516
540
 
517
541
  expect(getOutput(program, [<ClassDeclaration type={Widget} />])).toRenderTo(`
518
542
  from dataclasses import dataclass
519
- from typing import Never
543
+ from typing import TYPE_CHECKING
544
+
545
+ if TYPE_CHECKING:
546
+ from typing import Never
520
547
 
521
548
 
522
549
  @dataclass(kw_only=True)
@@ -538,7 +565,10 @@ describe("Python Class from model", () => {
538
565
  expect(getOutput(program, [<ClassDeclaration name="MyOperations" type={Widget} />]))
539
566
  .toRenderTo(`
540
567
  from dataclasses import dataclass
541
- from typing import Literal
568
+ from typing import TYPE_CHECKING
569
+
570
+ if TYPE_CHECKING:
571
+ from typing import Literal
542
572
 
543
573
 
544
574
  @dataclass(kw_only=True)
@@ -570,7 +600,10 @@ describe("Python Class from model", () => {
570
600
  ]),
571
601
  ).toRenderTo(`
572
602
  from dataclasses import dataclass
573
- from typing import Literal
603
+ from typing import TYPE_CHECKING
604
+
605
+ if TYPE_CHECKING:
606
+ from typing import Literal
574
607
 
575
608
 
576
609
  @dataclass(kw_only=True)
@@ -603,7 +636,10 @@ describe("Python Class from model", () => {
603
636
  ]),
604
637
  ).toRenderTo(`
605
638
  from dataclasses import dataclass
606
- from typing import Literal
639
+ from typing import TYPE_CHECKING
640
+
641
+ if TYPE_CHECKING:
642
+ from typing import Literal
607
643
 
608
644
 
609
645
  @dataclass(kw_only=True)
@@ -718,7 +754,10 @@ describe("Python Class from interface", () => {
718
754
  from abc import ABC
719
755
  from abc import abstractmethod
720
756
  from dataclasses import dataclass
721
- from typing import Literal
757
+ from typing import TYPE_CHECKING
758
+
759
+ if TYPE_CHECKING:
760
+ from typing import Literal
722
761
 
723
762
 
724
763
  class WidgetOperations(ABC):
@@ -772,7 +811,10 @@ describe("Python Class from interface", () => {
772
811
  from abc import ABC
773
812
  from abc import abstractmethod
774
813
  from dataclasses import dataclass
775
- from typing import Literal
814
+ from typing import TYPE_CHECKING
815
+
816
+ if TYPE_CHECKING:
817
+ from typing import Literal
776
818
 
777
819
 
778
820
  class WidgetOperations(ABC):
@@ -1230,7 +1272,10 @@ describe("Python Class overrides", () => {
1230
1272
  // CanadaAddress is a concrete type with all properties from Address<never>.
1231
1273
  expect(getOutput(program, [<ClassDeclaration type={CanadaAddress} />])).toRenderTo(`
1232
1274
  from dataclasses import dataclass
1233
- from typing import Never
1275
+ from typing import TYPE_CHECKING
1276
+
1277
+ if TYPE_CHECKING:
1278
+ from typing import Never
1234
1279
 
1235
1280
 
1236
1281
  @dataclass(kw_only=True)
@@ -1378,7 +1423,10 @@ describe("Python Class overrides", () => {
1378
1423
  // to be emitted, which is not supported since templates are macros.
1379
1424
  expect(getOutput(program, [<ClassDeclaration type={CanadaAddress} />])).toRenderTo(`
1380
1425
  from dataclasses import dataclass
1381
- from typing import Never
1426
+ from typing import TYPE_CHECKING
1427
+
1428
+ if TYPE_CHECKING:
1429
+ from typing import Never
1382
1430
 
1383
1431
 
1384
1432
  @dataclass(kw_only=True)
@@ -18,7 +18,10 @@ describe("Python Class Members", () => {
18
18
  expect(getOutput(program, [<ClassDeclaration type={MyModel} />])).toRenderTo(
19
19
  `
20
20
  from dataclasses import dataclass
21
- from typing import Optional
21
+ from typing import TYPE_CHECKING
22
+
23
+ if TYPE_CHECKING:
24
+ from typing import Optional
22
25
 
23
26
 
24
27
  @dataclass(kw_only=True)
@@ -43,7 +46,10 @@ describe("Python Class Members", () => {
43
46
  expect(getOutput(program, [<ClassDeclaration type={BooleanModel} />])).toRenderTo(
44
47
  `
45
48
  from dataclasses import dataclass
46
- from typing import Optional
49
+ from typing import TYPE_CHECKING
50
+
51
+ if TYPE_CHECKING:
52
+ from typing import Optional
47
53
 
48
54
 
49
55
  @dataclass(kw_only=True)
@@ -140,7 +146,10 @@ describe("Python Class Members", () => {
140
146
  expect(getOutput(program, [<ClassDeclaration type={NumericDefaults} />])).toRenderTo(
141
147
  `
142
148
  from dataclasses import dataclass
143
- from decimal import Decimal
149
+ from typing import TYPE_CHECKING
150
+
151
+ if TYPE_CHECKING:
152
+ from decimal import Decimal
144
153
 
145
154
 
146
155
  @dataclass(kw_only=True)
@@ -176,7 +185,10 @@ describe("Python Class Members", () => {
176
185
  expect(getOutput(program, [<ClassDeclaration type={MixedNumeric} />])).toRenderTo(
177
186
  `
178
187
  from dataclasses import dataclass
179
- from decimal import Decimal
188
+ from typing import TYPE_CHECKING
189
+
190
+ if TYPE_CHECKING:
191
+ from decimal import Decimal
180
192
 
181
193
 
182
194
  @dataclass(kw_only=True)
@@ -367,7 +367,10 @@ describe("Python Function Declaration", () => {
367
367
  `);
368
368
 
369
369
  expect(getOutput(program, [<FunctionDeclaration type={abort} />])).toRenderTo(`
370
- from typing import Never
370
+ from typing import TYPE_CHECKING
371
+
372
+ if TYPE_CHECKING:
373
+ from typing import Never
371
374
 
372
375
 
373
376
  def abort() -> Never:
@@ -14,7 +14,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
14
14
 
15
15
  expect(getOutput(program, [<TypeAliasDeclaration type={MyDate} />])).toRenderTo(`
16
16
  from datetime import datetime
17
- from typing import TypeAlias
17
+ from typing import TYPE_CHECKING
18
+
19
+ if TYPE_CHECKING:
20
+ from typing import TypeAlias
18
21
 
19
22
 
20
23
  my_date: TypeAlias = datetime`);
@@ -30,7 +33,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
30
33
 
31
34
  expect(getOutput(program, [<TypeAliasDeclaration type={MyDate} />])).toRenderTo(`
32
35
  from datetime import datetime
33
- from typing import TypeAlias
36
+ from typing import TYPE_CHECKING
37
+
38
+ if TYPE_CHECKING:
39
+ from typing import TypeAlias
34
40
 
35
41
 
36
42
  # Type to represent a date
@@ -48,7 +54,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
48
54
  expect(getOutput(program, [<TypeAliasDeclaration doc={"Overridden Doc"} type={MyDate} />]))
49
55
  .toRenderTo(`
50
56
  from datetime import datetime
51
- from typing import TypeAlias
57
+ from typing import TYPE_CHECKING
58
+
59
+ if TYPE_CHECKING:
60
+ from typing import TypeAlias
52
61
 
53
62
 
54
63
  # Overridden Doc
@@ -63,7 +72,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
63
72
 
64
73
  expect(getOutput(program, [<TypeAliasDeclaration type={MyDate} />])).toRenderTo(`
65
74
  from datetime import datetime
66
- from typing import TypeAlias
75
+ from typing import TYPE_CHECKING
76
+
77
+ if TYPE_CHECKING:
78
+ from typing import TypeAlias
67
79
 
68
80
 
69
81
  my_date: TypeAlias = datetime`);
@@ -77,7 +89,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
77
89
 
78
90
  expect(getOutput(program, [<TypeAliasDeclaration type={MyDate} />])).toRenderTo(`
79
91
  from datetime import datetime
80
- from typing import TypeAlias
92
+ from typing import TYPE_CHECKING
93
+
94
+ if TYPE_CHECKING:
95
+ from typing import TypeAlias
81
96
 
82
97
 
83
98
  my_date: TypeAlias = datetime`);
@@ -91,7 +106,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
91
106
 
92
107
  expect(getOutput(program, [<TypeAliasDeclaration type={MyDate} />])).toRenderTo(`
93
108
  from datetime import datetime
94
- from typing import TypeAlias
109
+ from typing import TYPE_CHECKING
110
+
111
+ if TYPE_CHECKING:
112
+ from typing import TypeAlias
95
113
 
96
114
 
97
115
  my_date: TypeAlias = datetime`);
@@ -108,7 +126,10 @@ describe("Python Declaration equivalency to Type Alias", () => {
108
126
 
109
127
  expect(getOutput(program, [<TypeAliasDeclaration type={Handler} />])).toRenderTo(`
110
128
  from typing import Callable
111
- from typing import TypeAlias
129
+ from typing import TYPE_CHECKING
130
+
131
+ if TYPE_CHECKING:
132
+ from typing import TypeAlias
112
133
 
113
134
 
114
135
  handle_request: TypeAlias = Callable[[str], str]`);
@@ -37,7 +37,10 @@ describe("Python TypeDeclaration dispatcher", () => {
37
37
  const output = getOutput(program, [<TypeDeclaration type={MyDate} />]);
38
38
  expect(output).toRenderTo(d`
39
39
  from datetime import datetime
40
- from typing import TypeAlias
40
+ from typing import TYPE_CHECKING
41
+
42
+ if TYPE_CHECKING:
43
+ from typing import TypeAlias
41
44
 
42
45
 
43
46
  my_date: TypeAlias = datetime`);
@@ -50,7 +53,10 @@ describe("Python TypeDeclaration dispatcher", () => {
50
53
 
51
54
  const output = getOutput(program, [<TypeDeclaration type={Items} />]);
52
55
  expect(output).toRenderTo(d`
53
- from typing import TypeAlias
56
+ from typing import TYPE_CHECKING
57
+
58
+ if TYPE_CHECKING:
59
+ from typing import TypeAlias
54
60
 
55
61
 
56
62
  items: TypeAlias = list[int]`);
package/vitest.config.ts CHANGED
@@ -10,10 +10,6 @@ export default mergeConfig(
10
10
  passWithNoTests: true,
11
11
  setupFiles: ["./test/vitest.setup.ts"],
12
12
  },
13
- esbuild: {
14
- jsx: "preserve",
15
- sourcemap: "both",
16
- },
17
13
  plugins: [alloyPlugin()],
18
14
  }),
19
15
  );