@kubb/plugin-ts 5.0.0-alpha.27 → 5.0.0-alpha.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-ts",
3
- "version": "5.0.0-alpha.27",
3
+ "version": "5.0.0-alpha.28",
4
4
  "description": "TypeScript code generation plugin for Kubb, transforming OpenAPI schemas into TypeScript interfaces, types, and utility functions.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -53,8 +53,8 @@
53
53
  "@kubb/react-fabric": "0.15.1",
54
54
  "remeda": "^2.33.7",
55
55
  "typescript": "5.9.3",
56
- "@kubb/ast": "5.0.0-alpha.27",
57
- "@kubb/core": "5.0.0-alpha.27"
56
+ "@kubb/ast": "5.0.0-alpha.28",
57
+ "@kubb/core": "5.0.0-alpha.28"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@kubb/react-fabric": "0.15.1"
@@ -100,7 +100,8 @@ export const functionPrinter = defineFunctionPrinter<DefaultPrinter>((options) =
100
100
  if (node.variant === 'struct') {
101
101
  const parts = node.properties.map((p) => {
102
102
  const typeStr = this.transform(p.type)
103
- return p.optional ? `${p.name}?: ${typeStr}` : `${p.name}: ${typeStr}`
103
+ const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(p.name) ? p.name : JSON.stringify(p.name)
104
+ return p.optional ? `${key}?: ${typeStr}` : `${key}: ${typeStr}`
104
105
  })
105
106
  return `{ ${parts.join('; ')} }`
106
107
  }