@kubb/plugin-ts 5.0.0-alpha.27 → 5.0.0-alpha.29
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/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/printers/functionPrinter.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-ts",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.29",
|
|
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.
|
|
57
|
-
"@kubb/core": "5.0.0-alpha.
|
|
56
|
+
"@kubb/ast": "5.0.0-alpha.29",
|
|
57
|
+
"@kubb/core": "5.0.0-alpha.29"
|
|
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
|
-
|
|
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
|
}
|