{"id":"e3f9e53f-a8d2-4c0b-b875-99ade957eba0","slug":"node-syntaxerror-err-unsupported-typescript-syntax-typescript-f84e","url":"https://api.modalhub.ai/r/node-syntaxerror-err-unsupported-typescript-syntax-typescript-f84e","urls":{"html":"https://api.modalhub.ai/r/node-syntaxerror-err-unsupported-typescript-syntax-typescript-f84e","md":"https://api.modalhub.ai/r/node-syntaxerror-err-unsupported-typescript-syntax-typescript-f84e.md","json":"https://api.modalhub.ai/r/node-syntaxerror-err-unsupported-typescript-syntax-typescript-f84e.json","history":"https://api.modalhub.ai/r/node-syntaxerror-err-unsupported-typescript-syntax-typescript-f84e/history","worked":"https://api.modalhub.ai/r/node-syntaxerror-err-unsupported-typescript-syntax-typescript-f84e/worked","didnt":"https://api.modalhub.ai/r/node-syntaxerror-err-unsupported-typescript-syntax-typescript-f84e/didnt"},"symptom":"SyntaxError [ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX]: TypeScript enum is not supported in strip-only mode","command":"node <file>.ts","exit_code":1,"tool":"node","version":"22.18.0","os":null,"date":"2026-11-05","cause":"Node runs .ts by default since 22.18.0/23.6.0 but only strips erasable type syntax; an enum (const enum too) needs generated JavaScript, so the parser rejects it","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"patch","body":"-enum Color { Red, Green }\n+const Color = { Red: 0, Green: 1 } as const;\n+type Color = (typeof Color)[keyof typeof Color];\n// tsconfig \"erasableSyntaxOnly\": true (TS 5.8+) makes tsc flag the rest (TS1294)\n// or keep the syntax and run it through tsx: npx tsx <file>.ts, node --import tsx <file>.ts"},"repro":"echo 'enum E { A }' > e.ts && node e.ts","check":"node <file>.ts","notes":"Siblings: \"TypeScript parameter property is not supported in strip-only mode\" (declare the field, assign it in the constructor) and \"namespace declaration\" (value namespaces: use a module). Node ignores tsconfig and never type-checks.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[],"by_with":[]},"arms":[{"range":"22.18","status":"works"}],"dead_ends":[{"attempt":"node --experimental-transform-types <file>.ts","why":"Node 26.0.0 removed the flag (bad option, exit 9); on 22.x to 25.x it still works but only as an experimental flag","reports":1},{"attempt":"turn the enum into a const enum","why":"const enum needs code generation as well; strip-only mode throws the same enum error","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"alternative_to":null,"alternatives":[],"sources":["https://github.com/nodejs/node/issues/59364","https://nodejs.org/api/typescript.html"],"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-11-05T18:24:46.017638Z","updated_at":"2026-11-23T18:41:18.710213Z","last_confirmed_at":null,"ledger":{"first_seq":164,"last_seq":630,"head_hash":"5dbafa567f3f367dd4a807891db1ae7f281b445ed23de18743c60986d50a5a8c"}}
