@kubb/ts-codegen
Advanced tools
Comparing version 1.0.0-beta.6 to 1.0.0-beta.7
@@ -58,3 +58,3 @@ import ts from 'typescript'; | ||
typeName: string; | ||
enums: string[]; | ||
enums: [key: string, value: string | number][]; | ||
}): (ts.TypeAliasDeclaration | ts.VariableStatement)[]; | ||
@@ -61,0 +61,0 @@ declare function createIntersectionDeclaration({ nodes }: { |
@@ -123,4 +123,7 @@ import { createRequire } from 'module'; | ||
factory.createObjectLiteralExpression( | ||
enums.map((text) => { | ||
return factory.createPropertyAssignment(factory.createStringLiteral(text.toString()), factory.createStringLiteral(text)); | ||
enums.map(([key, value]) => { | ||
return factory.createPropertyAssignment( | ||
factory.createStringLiteral(`${key}`), | ||
typeof value === "number" ? factory.createNumericLiteral(value) : factory.createStringLiteral(`${value}`) | ||
); | ||
}), | ||
@@ -127,0 +130,0 @@ true |
{ | ||
"name": "@kubb/ts-codegen", | ||
"version": "1.0.0-beta.6", | ||
"version": "1.0.0-beta.7", | ||
"description": "Generator ts-codegen", | ||
@@ -45,3 +45,3 @@ "repository": { | ||
"dependencies": { | ||
"@kubb/core": "1.0.0-beta.6", | ||
"@kubb/core": "1.0.0-beta.7", | ||
"typescript": "^5.0.3" | ||
@@ -48,0 +48,0 @@ }, |
@@ -150,3 +150,3 @@ import ts from 'typescript' | ||
export function createEnumDeclaration({ name, typeName, enums }: { name: string; typeName: string; enums: string[] }) { | ||
export function createEnumDeclaration({ name, typeName, enums }: { name: string; typeName: string; enums: [key: string, value: string | number][] }) { | ||
return [ | ||
@@ -163,4 +163,7 @@ factory.createVariableStatement( | ||
factory.createObjectLiteralExpression( | ||
enums.map((text) => { | ||
return factory.createPropertyAssignment(factory.createStringLiteral(text.toString()), factory.createStringLiteral(text)) | ||
enums.map(([key, value]) => { | ||
return factory.createPropertyAssignment( | ||
factory.createStringLiteral(`${key}`), | ||
typeof value === 'number' ? factory.createNumericLiteral(value) : factory.createStringLiteral(`${value}`) | ||
) | ||
}), | ||
@@ -167,0 +170,0 @@ true |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
61175
771
+ Added@kubb/core@1.0.0-beta.7(transitive)
- Removed@kubb/core@1.0.0-beta.6(transitive)
Updated@kubb/core@1.0.0-beta.7