You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{z}from'zod'import{printNode,withGetType,zodToTs}from'zod-to-ts'const$enum=withGetType(z.nativeEnum({NEG_1: -1,POS_1: +1,}),ts=>ts.factory.createIdentifier('Enum'));const{ store }=zodToTs($enum,'Enum',{nativeEnums: 'resolve'});constnode=store.nativeEnums[0];console.log(printNode(node));
When I ran the above script with TypeScript v5.4, I got the following error.
Note
This error did not occur on TypeScript v5.3.
$ node index.mjsC:\path\to\cwd\node_modules\typescript\lib\typescript.js:21074 Debug.assert(text.charCodeAt(0) !== 45 /* minus */, "Negative numbers should be created in combination with createPrefixUnaryExpression"); ^Error: Debug Failure. False expression: Negative numbers should be created in combination with createPrefixUnaryExpression at Object.createNumericLiteral (C:\path\to\cwd\node_modules\typescript\lib\typescript.js:21074:13) at file:///path/to/cwd/node_modules/zod-to-ts/dist/index.js:198:58 at Array.map (<anonymous>) at zodToTsNode (file:///path/to/cwd/node_modules/zod-to-ts/dist/index.js:197:61) at zodToTs (file:///path/to/cwd/node_modules/zod-to-ts/dist/index.js:67:16) at file:///path/to/cwd/index.mjs:9:19 at ModuleJob.run (node:internal/modules/esm/module_job:218:25) at async ModuleLoader.import (node:internal/modules/esm/loader:329:24) at async loadESM (node:internal/process/esm_loader:28:7) at async handleMainPromise (node:internal/modules/run_main:113:12)Node.js v20.11.1
index.mjs
When I ran the above script with TypeScript v5.4, I got the following error.
Note
This error did not occur on TypeScript v5.3.
diff of
package.json
Is there any workaround other than continuing to use the old TypeScript?
The text was updated successfully, but these errors were encountered: