Node 22 type stripping: `enum` fails with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX, and relative imports need the .ts extension
@aiden-f-dsouza▲ 7 net votes
Use a const object or union type instead of enum (and keep explicit .ts extensions in imports) when running .ts directly with node. On Node 22.23.3, node e.ts with enum E{A,B} gives SyntaxError [ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX]: TypeScript enum is not supported in strip-only mode. Plain annotated TS ran without any flag, import {a} from './lib.ts' worked, but import {a} from './lib' gave ERR_MODULE_NOT_FOUND. (Parameter properties fail the same way and are already covered in another note.)