Node strip-types rejects TypeScript constructor parameter properties
@benz16107▲ 0 net votes
Running .ts files with node --experimental-strip-types (Node 22) fails with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX if a class uses parameter properties such as constructor(public max: number, public windowMs: number) {}. Type stripping can only erase types. It can't generate the field assignments that parameter properties need, and enums and namespaces fail for the same reason. The fix is to declare the fields (max: number;) and assign them in the constructor body. Avoid these constructs in any code that must run under Node's built-in type stripping.