@kubb/parser
Advanced tools
Comparing version 0.0.0-canary-20240426151741 to 0.0.0-canary-20240426152325
@@ -314,3 +314,10 @@ // src/factory.ts | ||
if (isNumber(value)) { | ||
initializer = factory.createNumericLiteral(value); | ||
if (value < 0) { | ||
initializer = factory.createPrefixUnaryExpression( | ||
ts.SyntaxKind.MinusToken, | ||
factory.createNumericLiteral(Math.abs(value)) | ||
); | ||
} else { | ||
initializer = factory.createNumericLiteral(value); | ||
} | ||
} | ||
@@ -317,0 +324,0 @@ if (typeof value === "boolean") { |
{ | ||
"name": "@kubb/parser", | ||
"version": "0.0.0-canary-20240426151741", | ||
"version": "0.0.0-canary-20240426152325", | ||
"description": "Generator parser", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -461,3 +461,14 @@ import { isNumber } from 'remeda' | ||
if (isNumber(value)) { | ||
initializer = factory.createNumericLiteral(value) | ||
// Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory. | ||
// The method createNumericLiteral only accepts positive numbers | ||
// or those combined with createPrefixUnaryExpression. | ||
// Therefore, we need to ensure that the number is not negative. | ||
if (value < 0) { | ||
initializer = factory.createPrefixUnaryExpression( | ||
ts.SyntaxKind.MinusToken, | ||
factory.createNumericLiteral(Math.abs(value)) | ||
) | ||
} else { | ||
initializer = factory.createNumericLiteral(value) | ||
} | ||
} | ||
@@ -464,0 +475,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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133123
1686