@kubb/parser
Advanced tools
Comparing version 0.0.0-canary-20240328221221 to 0.0.0-canary-20240331163352
@@ -79,3 +79,3 @@ import { | ||
if (typeof value === "string") { | ||
return !isNaN((0, import_lodash.default)(value)); | ||
return !Number.isNaN((0, import_lodash.default)(value)); | ||
} | ||
@@ -132,8 +132,6 @@ return typeof value === "number"; | ||
} | ||
if (nodes.length == 1) { | ||
if (nodes.length === 1) { | ||
return factory.createArrayTypeNode(nodes.at(0)); | ||
} | ||
return factory.createExpressionWithTypeArguments(factory.createIdentifier("Array"), [ | ||
factory.createUnionTypeNode(nodes) | ||
]); | ||
return factory.createExpressionWithTypeArguments(factory.createIdentifier("Array"), [factory.createUnionTypeNode(nodes)]); | ||
} | ||
@@ -164,6 +162,3 @@ function createUnionDeclaration({ | ||
return factory.createPropertySignature( | ||
[ | ||
...modifiers2, | ||
readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : void 0 | ||
].filter(Boolean), | ||
[...modifiers2, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : void 0].filter(Boolean), | ||
propertyName(name), | ||
@@ -181,10 +176,3 @@ createQuestionToken(questionToken2), | ||
}) { | ||
return factory.createParameterDeclaration( | ||
modifiers2, | ||
dotDotDotToken, | ||
name, | ||
createQuestionToken(questionToken2), | ||
type, | ||
initializer | ||
); | ||
return factory.createParameterDeclaration(modifiers2, dotDotDotToken, name, createQuestionToken(questionToken2), type, initializer); | ||
} | ||
@@ -219,9 +207,4 @@ function createJSDoc({ comments }) { | ||
}, "*"); | ||
return ts.addSyntheticLeadingComment( | ||
{ ...node }, | ||
ts.SyntaxKind.MultiLineCommentTrivia, | ||
`${text || "*"} | ||
`, | ||
true | ||
); | ||
return ts.addSyntheticLeadingComment({ ...node }, ts.SyntaxKind.MultiLineCommentTrivia, `${text || "*"} | ||
`, true); | ||
} | ||
@@ -233,7 +216,3 @@ function createIndexSignature(type, { | ||
} = {}) { | ||
return factory.createIndexSignature( | ||
modifiers2, | ||
[createParameterSignature(indexName, { type: indexType })], | ||
type | ||
); | ||
return factory.createIndexSignature(modifiers2, [createParameterSignature(indexName, { type: indexType })], type); | ||
} | ||
@@ -246,8 +225,3 @@ function createTypeAliasDeclaration({ | ||
}) { | ||
return factory.createTypeAliasDeclaration( | ||
modifiers2, | ||
name, | ||
typeParameters, | ||
type | ||
); | ||
return factory.createTypeAliasDeclaration(modifiers2, name, typeParameters, type); | ||
} | ||
@@ -276,5 +250,3 @@ function createNamespaceDeclaration({ | ||
importPropertyName = void 0; | ||
importName = factory.createNamespaceImport( | ||
factory.createIdentifier(name) | ||
); | ||
importName = factory.createNamespaceImport(factory.createIdentifier(name)); | ||
} | ||
@@ -298,19 +270,7 @@ return factory.createImportDeclaration( | ||
if (obj.name) { | ||
return factory.createImportSpecifier( | ||
false, | ||
factory.createIdentifier(obj.propertyName), | ||
factory.createIdentifier(obj.name) | ||
); | ||
return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name)); | ||
} | ||
return factory.createImportSpecifier( | ||
false, | ||
void 0, | ||
factory.createIdentifier(obj.propertyName) | ||
); | ||
return factory.createImportSpecifier(false, void 0, factory.createIdentifier(obj.propertyName)); | ||
} | ||
return factory.createImportSpecifier( | ||
false, | ||
void 0, | ||
factory.createIdentifier(item) | ||
); | ||
return factory.createImportSpecifier(false, void 0, factory.createIdentifier(item)); | ||
}) | ||
@@ -347,7 +307,3 @@ ) | ||
name.map((propertyName2) => { | ||
return factory.createExportSpecifier( | ||
false, | ||
void 0, | ||
typeof propertyName2 === "string" ? factory.createIdentifier(propertyName2) : propertyName2 | ||
); | ||
return factory.createExportSpecifier(false, void 0, typeof propertyName2 === "string" ? factory.createIdentifier(propertyName2) : propertyName2); | ||
}) | ||
@@ -374,15 +330,9 @@ ), | ||
if (isNumber(value)) { | ||
return factory.createLiteralTypeNode( | ||
factory.createNumericLiteral(value?.toString()) | ||
); | ||
return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString())); | ||
} | ||
if (typeof value === "boolean") { | ||
return factory.createLiteralTypeNode( | ||
value ? factory.createTrue() : factory.createFalse() | ||
); | ||
return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse()); | ||
} | ||
if (value) { | ||
return factory.createLiteralTypeNode( | ||
factory.createStringLiteral(value.toString()) | ||
); | ||
return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString())); | ||
} | ||
@@ -398,11 +348,6 @@ return void 0; | ||
factory.createEnumDeclaration( | ||
[ | ||
factory.createToken(ts.SyntaxKind.ExportKeyword), | ||
type === "constEnum" ? factory.createToken(ts.SyntaxKind.ConstKeyword) : void 0 | ||
].filter(Boolean), | ||
[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 (isNumber(value)) { | ||
@@ -415,12 +360,6 @@ initializer = factory.createNumericLiteral((0, import_lodash.default)(value)); | ||
if (isNumber(key)) { | ||
return factory.createEnumMember( | ||
factory.createStringLiteral(`${typeName}_${key}`), | ||
initializer | ||
); | ||
return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer); | ||
} | ||
if (key) { | ||
return factory.createEnumMember( | ||
factory.createStringLiteral(`${key}`), | ||
initializer | ||
); | ||
return factory.createEnumMember(factory.createStringLiteral(`${key}`), initializer); | ||
} | ||
@@ -445,5 +384,3 @@ return void 0; | ||
enums.map(([key, value]) => { | ||
let initializer = factory.createStringLiteral( | ||
`${value?.toString()}` | ||
); | ||
let initializer = factory.createStringLiteral(`${value?.toString()}`); | ||
if (isNumber(value)) { | ||
@@ -456,6 +393,3 @@ initializer = factory.createNumericLiteral(value); | ||
if (key) { | ||
return factory.createPropertyAssignment( | ||
factory.createStringLiteral(`${key}`), | ||
initializer | ||
); | ||
return factory.createPropertyAssignment(factory.createStringLiteral(`${key}`), initializer); | ||
} | ||
@@ -466,6 +400,3 @@ return void 0; | ||
), | ||
factory.createTypeReferenceNode( | ||
factory.createIdentifier("const"), | ||
void 0 | ||
) | ||
factory.createTypeReferenceNode(factory.createIdentifier("const"), void 0) | ||
) | ||
@@ -482,15 +413,4 @@ ) | ||
factory.createIndexedAccessTypeNode( | ||
factory.createParenthesizedType( | ||
factory.createTypeQueryNode( | ||
factory.createIdentifier(identifierName), | ||
void 0 | ||
) | ||
), | ||
factory.createTypeOperatorNode( | ||
ts.SyntaxKind.KeyOfKeyword, | ||
factory.createTypeQueryNode( | ||
factory.createIdentifier(identifierName), | ||
void 0 | ||
) | ||
) | ||
factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0)), | ||
factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0)) | ||
) | ||
@@ -505,5 +425,3 @@ ) | ||
}) { | ||
const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier("NonNullable"), [ | ||
type | ||
]) : type; | ||
const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier("NonNullable"), [type]) : type; | ||
if (Array.isArray(keys)) { | ||
@@ -514,5 +432,3 @@ return factory.createTypeReferenceNode(factory.createIdentifier("Omit"), [ | ||
keys.map((key) => { | ||
return factory.createLiteralTypeNode( | ||
factory.createStringLiteral(key) | ||
); | ||
return factory.createLiteralTypeNode(factory.createStringLiteral(key)); | ||
}) | ||
@@ -522,6 +438,3 @@ ) | ||
} | ||
return factory.createTypeReferenceNode(factory.createIdentifier("Omit"), [ | ||
node, | ||
factory.createLiteralTypeNode(factory.createStringLiteral(keys)) | ||
]); | ||
return factory.createTypeReferenceNode(factory.createIdentifier("Omit"), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))]); | ||
} | ||
@@ -537,5 +450,3 @@ var keywordTypeNodes = { | ||
undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword), | ||
null: factory.createLiteralTypeNode( | ||
factory.createToken(ts.SyntaxKind.NullKeyword) | ||
) | ||
null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)) | ||
}; | ||
@@ -542,0 +453,0 @@ var createTypeLiteralNode = factory.createTypeLiteralNode; |
@@ -52,3 +52,8 @@ import { | ||
const sourceFile = ts2.createSourceFile(baseName, escapeNewLines(source), ts2.ScriptTarget.ES2022, false, ts2.ScriptKind.TS); | ||
const printer = ts2.createPrinter({ omitTrailingSemicolon: true, newLine, removeComments, noEmitHelpers }); | ||
const printer = ts2.createPrinter({ | ||
omitTrailingSemicolon: true, | ||
newLine, | ||
removeComments, | ||
noEmitHelpers | ||
}); | ||
let nodes = []; | ||
@@ -55,0 +60,0 @@ if (!elements) { |
{ | ||
"name": "@kubb/parser", | ||
"version": "0.0.0-canary-20240328221221", | ||
"version": "0.0.0-canary-20240331163352", | ||
"description": "Generator parser", | ||
@@ -56,2 +56,3 @@ "keywords": [ | ||
"eslint": "^8.57.0", | ||
"prettier": "^3.2.5", | ||
"lodash.tonumber": "^4.0.3", | ||
@@ -58,0 +59,0 @@ "tsup": "^8.0.2", |
@@ -14,5 +14,3 @@ import path from 'node:path' | ||
export function getExports(filePath: string): undefined | Array<ExportsResult> { | ||
const rootName = path.extname(filePath) | ||
? filePath | ||
: `${filePath}.ts` | ||
const rootName = path.extname(filePath) ? filePath : `${filePath}.ts` | ||
@@ -30,3 +28,3 @@ if (!rootName) { | ||
const sources = program.getSourceFiles() | ||
const sourceFile = sources.find(sourceFile => sourceFile.fileName === rootName) | ||
const sourceFile = sources.find((sourceFile) => sourceFile.fileName === rootName) | ||
@@ -44,3 +42,3 @@ if (!sourceFile) { | ||
const exports = checker.getExportsOfModule(symbol) | ||
return exports.map(e => { | ||
return exports.map((e) => { | ||
// 5 is type and 90 is const | ||
@@ -47,0 +45,0 @@ const type = checker.getTypeOfSymbol(e) as unknown as { id?: 5 | 90 } |
@@ -23,8 +23,3 @@ /* eslint-disable @typescript-eslint/unbound-method */ | ||
return ( | ||
!!node | ||
&& node.kind === ts.SyntaxKind.Identifier | ||
&& ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) | ||
=== undefined | ||
) | ||
return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) === undefined | ||
} | ||
@@ -34,5 +29,3 @@ | ||
if (typeof name === 'string') { | ||
return isValidIdentifier(name) | ||
? factory.createIdentifier(name) | ||
: factory.createStringLiteral(name) | ||
return isValidIdentifier(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name) | ||
} | ||
@@ -44,3 +37,3 @@ return name | ||
if (typeof value === 'string') { | ||
return !isNaN(toNumber(value)) | ||
return !Number.isNaN(toNumber(value)) | ||
} | ||
@@ -123,9 +116,7 @@ return typeof value === 'number' | ||
if (nodes.length == 1) { | ||
if (nodes.length === 1) { | ||
return factory.createArrayTypeNode(nodes.at(0)!) | ||
} | ||
return factory.createExpressionWithTypeArguments(factory.createIdentifier('Array'), [ | ||
factory.createUnionTypeNode(nodes), | ||
]) | ||
return factory.createExpressionWithTypeArguments(factory.createIdentifier('Array'), [factory.createUnionTypeNode(nodes)]) | ||
} | ||
@@ -175,6 +166,3 @@ | ||
return factory.createPropertySignature( | ||
[ | ||
...modifiers, | ||
readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined, | ||
].filter(Boolean), | ||
[...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean), | ||
propertyName(name), | ||
@@ -203,10 +191,3 @@ createQuestionToken(questionToken), | ||
): ts.ParameterDeclaration { | ||
return factory.createParameterDeclaration( | ||
modifiers, | ||
dotDotDotToken, | ||
name, | ||
createQuestionToken(questionToken), | ||
type, | ||
initializer, | ||
) | ||
return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer) | ||
} | ||
@@ -252,8 +233,3 @@ | ||
// node: {...node}, with that ts.addSyntheticLeadingComment is appending | ||
return ts.addSyntheticLeadingComment( | ||
{ ...node }, | ||
ts.SyntaxKind.MultiLineCommentTrivia, | ||
`${text || '*'}\n`, | ||
true, | ||
) | ||
return ts.addSyntheticLeadingComment({ ...node }, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\n`, true) | ||
} | ||
@@ -274,7 +250,3 @@ | ||
) { | ||
return factory.createIndexSignature( | ||
modifiers, | ||
[createParameterSignature(indexName, { type: indexType })], | ||
type, | ||
) | ||
return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type) | ||
} | ||
@@ -293,8 +265,3 @@ | ||
}) { | ||
return factory.createTypeAliasDeclaration( | ||
modifiers, | ||
name, | ||
typeParameters, | ||
type, | ||
) | ||
return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type) | ||
} | ||
@@ -338,5 +305,3 @@ | ||
importPropertyName = undefined | ||
importName = factory.createNamespaceImport( | ||
factory.createIdentifier(name), | ||
) | ||
importName = factory.createNamespaceImport(factory.createIdentifier(name)) | ||
} | ||
@@ -362,21 +327,9 @@ | ||
if (obj.name) { | ||
return factory.createImportSpecifier( | ||
false, | ||
factory.createIdentifier(obj.propertyName), | ||
factory.createIdentifier(obj.name), | ||
) | ||
return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name)) | ||
} | ||
return factory.createImportSpecifier( | ||
false, | ||
undefined, | ||
factory.createIdentifier(obj.propertyName), | ||
) | ||
return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName)) | ||
} | ||
return factory.createImportSpecifier( | ||
false, | ||
undefined, | ||
factory.createIdentifier(item), | ||
) | ||
return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item)) | ||
}), | ||
@@ -411,5 +364,3 @@ ), | ||
isTypeOnly, | ||
asAlias && parsedName | ||
? factory.createNamespaceExport(factory.createIdentifier(parsedName)) | ||
: undefined, | ||
asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined, | ||
factory.createStringLiteral(path), | ||
@@ -425,9 +376,3 @@ undefined, | ||
name.map((propertyName) => { | ||
return factory.createExportSpecifier( | ||
false, | ||
undefined, | ||
typeof propertyName === 'string' | ||
? factory.createIdentifier(propertyName) | ||
: propertyName, | ||
) | ||
return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName) | ||
}), | ||
@@ -467,22 +412,18 @@ ), | ||
factory.createUnionTypeNode( | ||
enums.map(([_key, value]) => { | ||
if (isNumber(value)) { | ||
return factory.createLiteralTypeNode( | ||
factory.createNumericLiteral(value?.toString()), | ||
) | ||
} | ||
enums | ||
.map(([_key, value]) => { | ||
if (isNumber(value)) { | ||
return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString())) | ||
} | ||
if (typeof value === 'boolean') { | ||
return factory.createLiteralTypeNode( | ||
value ? factory.createTrue() : factory.createFalse(), | ||
) | ||
} | ||
if (value) { | ||
return factory.createLiteralTypeNode( | ||
factory.createStringLiteral(value.toString()), | ||
) | ||
} | ||
if (typeof value === 'boolean') { | ||
return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse()) | ||
} | ||
if (value) { | ||
return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString())) | ||
} | ||
return undefined | ||
}).filter(Boolean), | ||
return undefined | ||
}) | ||
.filter(Boolean), | ||
), | ||
@@ -496,37 +437,26 @@ ), | ||
factory.createEnumDeclaration( | ||
[ | ||
factory.createToken(ts.SyntaxKind.ExportKeyword), | ||
type === 'constEnum' | ||
? factory.createToken(ts.SyntaxKind.ConstKeyword) | ||
: undefined, | ||
].filter(Boolean), | ||
[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(), | ||
) | ||
enums | ||
.map(([key, value]) => { | ||
let initializer: ts.Expression = factory.createStringLiteral(value?.toString()) | ||
if (isNumber(value)) { | ||
initializer = factory.createNumericLiteral(toNumber(value)) | ||
} | ||
if (typeof value === 'boolean') { | ||
initializer = value ? factory.createTrue() : factory.createFalse() | ||
} | ||
if (isNumber(value)) { | ||
initializer = factory.createNumericLiteral(toNumber(value)) | ||
} | ||
if (typeof value === 'boolean') { | ||
initializer = value ? factory.createTrue() : factory.createFalse() | ||
} | ||
if (isNumber(key)) { | ||
return factory.createEnumMember( | ||
factory.createStringLiteral(`${typeName}_${key}`), | ||
initializer, | ||
) | ||
} | ||
if (isNumber(key)) { | ||
return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer) | ||
} | ||
if (key) { | ||
return factory.createEnumMember( | ||
factory.createStringLiteral(`${key}`), | ||
initializer, | ||
) | ||
} | ||
if (key) { | ||
return factory.createEnumMember(factory.createStringLiteral(`${key}`), initializer) | ||
} | ||
return undefined | ||
}).filter(Boolean), | ||
return undefined | ||
}) | ||
.filter(Boolean), | ||
), | ||
@@ -550,32 +480,24 @@ ] | ||
factory.createObjectLiteralExpression( | ||
enums.map(([key, value]) => { | ||
let initializer: ts.Expression = factory.createStringLiteral( | ||
`${value?.toString()}`, | ||
) | ||
enums | ||
.map(([key, value]) => { | ||
let initializer: ts.Expression = factory.createStringLiteral(`${value?.toString()}`) | ||
if (isNumber(value)) { | ||
initializer = factory.createNumericLiteral(value) | ||
} | ||
if (isNumber(value)) { | ||
initializer = factory.createNumericLiteral(value) | ||
} | ||
if (typeof value === 'boolean') { | ||
initializer = value | ||
? factory.createTrue() | ||
: factory.createFalse() | ||
} | ||
if (typeof value === 'boolean') { | ||
initializer = value ? factory.createTrue() : factory.createFalse() | ||
} | ||
if (key) { | ||
return factory.createPropertyAssignment( | ||
factory.createStringLiteral(`${key}`), | ||
initializer, | ||
) | ||
} | ||
if (key) { | ||
return factory.createPropertyAssignment(factory.createStringLiteral(`${key}`), initializer) | ||
} | ||
return undefined | ||
}).filter(Boolean), | ||
return undefined | ||
}) | ||
.filter(Boolean), | ||
true, | ||
), | ||
factory.createTypeReferenceNode( | ||
factory.createIdentifier('const'), | ||
undefined, | ||
), | ||
factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined), | ||
), | ||
@@ -592,15 +514,4 @@ ), | ||
factory.createIndexedAccessTypeNode( | ||
factory.createParenthesizedType( | ||
factory.createTypeQueryNode( | ||
factory.createIdentifier(identifierName), | ||
undefined, | ||
), | ||
), | ||
factory.createTypeOperatorNode( | ||
ts.SyntaxKind.KeyOfKeyword, | ||
factory.createTypeQueryNode( | ||
factory.createIdentifier(identifierName), | ||
undefined, | ||
), | ||
), | ||
factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)), | ||
factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)), | ||
), | ||
@@ -620,7 +531,3 @@ ), | ||
}) { | ||
const node = nonNullable | ||
? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [ | ||
type, | ||
]) | ||
: type | ||
const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type | ||
@@ -632,5 +539,3 @@ if (Array.isArray(keys)) { | ||
keys.map((key) => { | ||
return factory.createLiteralTypeNode( | ||
factory.createStringLiteral(key), | ||
) | ||
return factory.createLiteralTypeNode(factory.createStringLiteral(key)) | ||
}), | ||
@@ -641,6 +546,3 @@ ), | ||
return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [ | ||
node, | ||
factory.createLiteralTypeNode(factory.createStringLiteral(keys)), | ||
]) | ||
return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))]) | ||
} | ||
@@ -657,5 +559,3 @@ | ||
undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword), | ||
null: factory.createLiteralTypeNode( | ||
factory.createToken(ts.SyntaxKind.NullKeyword), | ||
), | ||
null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)), | ||
} as const | ||
@@ -662,0 +562,0 @@ |
@@ -31,3 +31,8 @@ import ts from 'typescript' | ||
const sourceFile = ts.createSourceFile(baseName, escapeNewLines(source), ts.ScriptTarget.ES2022, false, ts.ScriptKind.TS) | ||
const printer = ts.createPrinter({ omitTrailingSemicolon: true, newLine, removeComments, noEmitHelpers }) | ||
const printer = ts.createPrinter({ | ||
omitTrailingSemicolon: true, | ||
newLine, | ||
removeComments, | ||
noEmitHelpers, | ||
}) | ||
@@ -34,0 +39,0 @@ let nodes: Array<ts.Node> = [] |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
151652
8
1871