🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@kubb/ts-codegen

Package Overview
Dependencies
Maintainers
1
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kubb/ts-codegen - npm Package Compare versions

Comparing version

to
1.0.0-beta.19

8

dist/index.d.ts

@@ -60,4 +60,10 @@ import ts from 'typescript';

declare function createEnumDeclaration({ name, typeName, enums, type, }: {
type: 'enum' | 'asConst';
type: 'enum' | 'asConst' | 'asPascalConst';
/**
* Enum name in camelCase.
*/
name: string;
/**
* Enum name in PascalCase.
*/
typeName: string;

@@ -64,0 +70,0 @@ enums: [key: string, value: string | number][];

7

dist/index.js

@@ -167,2 +167,3 @@ import { createRequire } from 'module';

}
const identifierName = type === "asPascalConst" ? typeName : name;
return [

@@ -174,3 +175,3 @@ factory.createVariableStatement(

factory.createVariableDeclaration(
factory.createIdentifier(name),
factory.createIdentifier(identifierName),
void 0,

@@ -200,4 +201,4 @@ void 0,

factory.createIndexedAccessTypeNode(
factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(name), void 0)),
factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(name), void 0))
factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0)),
factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0))
)

@@ -204,0 +205,0 @@ )

{
"name": "@kubb/ts-codegen",
"version": "1.0.0-beta.18",
"version": "1.0.0-beta.19",
"description": "Generator ts-codegen",

@@ -5,0 +5,0 @@ "repository": {

@@ -200,4 +200,10 @@ import ts from 'typescript'

}: {
type: 'enum' | 'asConst'
type: 'enum' | 'asConst' | 'asPascalConst'
/**
* Enum name in camelCase.
*/
name: string
/**
* Enum name in PascalCase.
*/
typeName: string

@@ -221,2 +227,5 @@ enums: [key: string, value: string | number][]

// used when using `as const` instead of an TypeScript enum.
const identifierName = type === 'asPascalConst' ? typeName : name
return [

@@ -228,3 +237,3 @@ factory.createVariableStatement(

factory.createVariableDeclaration(
factory.createIdentifier(name),
factory.createIdentifier(identifierName),
undefined,

@@ -254,4 +263,4 @@ undefined,

factory.createIndexedAccessTypeNode(
factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(name), undefined)),
factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(name), undefined))
factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),
factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined))
)

@@ -258,0 +267,0 @@ ),

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