Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kubb/parser

Package Overview
Dependencies
Maintainers
1
Versions
219
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kubb/parser - npm Package Compare versions

Comparing version 0.0.0-canary-20240114112243 to 0.0.0-canary-20240114133034

2

dist/factory.d.ts

@@ -94,3 +94,3 @@ import ts from 'typescript';

*/
type?: 'enum' | 'asConst' | 'asPascalConst';
type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
/**

@@ -97,0 +97,0 @@ * Enum name in camelCase.

@@ -229,9 +229,27 @@ import ts from 'typescript';

}) {
if (type === "enum") {
if (type === "literal") {
return [
factory.createEnumDeclaration(
factory.createTypeAliasDeclaration(
[factory.createToken(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier(typeName),
void 0,
factory.createUnionTypeNode(enums.map(([_key, value]) => {
if (typeof value === "number") {
return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()));
}
if (typeof value === "boolean") {
return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse());
}
return factory.createLiteralTypeNode(factory.createStringLiteral(value?.toString()));
}))
)
];
}
if (type === "enum" || type === "constEnum") {
return [
factory.createEnumDeclaration(
[factory.createToken(ts.SyntaxKind.ExportKeyword), type === "constEnum" ? factory.createToken(ts.SyntaxKind.ConstKeyword) : void 0].filter(Boolean),
factory.createIdentifier(typeName),
enums.map(([key, value]) => {
let initializer = factory.createStringLiteral(`${value?.toString()}`);
let initializer = factory.createStringLiteral(value?.toString());
if (typeof value === "number") {

@@ -238,0 +256,0 @@ initializer = factory.createNumericLiteral(value);

{
"name": "@kubb/parser",
"version": "0.0.0-canary-20240114112243",
"version": "0.0.0-canary-20240114133034",
"description": "Generator parser",

@@ -5,0 +5,0 @@ "keywords": [

@@ -335,3 +335,3 @@ /* eslint-disable @typescript-eslint/unbound-method */

*/
type?: 'enum' | 'asConst' | 'asPascalConst'
type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'
/**

@@ -347,9 +347,30 @@ * Enum name in camelCase.

}) {
if (type === 'enum') {
if (type === 'literal') {
return [
factory.createEnumDeclaration(
factory.createTypeAliasDeclaration(
[factory.createToken(ts.SyntaxKind.ExportKeyword)],
factory.createIdentifier(typeName),
undefined,
factory.createUnionTypeNode(enums.map(([_key, value]) => {
if (typeof value === 'number') {
return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))
}
if (typeof value === 'boolean') {
return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())
}
return factory.createLiteralTypeNode(factory.createStringLiteral(value?.toString()))
})),
),
]
}
if (type === 'enum' || type === 'constEnum') {
return [
factory.createEnumDeclaration(
[factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),
factory.createIdentifier(typeName),
enums.map(([key, value]) => {
let initializer: ts.Expression = factory.createStringLiteral(`${value?.toString()}`)
let initializer: ts.Expression = factory.createStringLiteral(value?.toString())

@@ -356,0 +377,0 @@ if (typeof value === 'number') {

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc