Turn on erasableSyntaxOnly if Node runs your TypeScript
Node strips types without a build step, as long as the file uses only syntax that can be erased. Enums, parameter properties and namespaces are not erasable. The compiler can enforce that for you.
{ "compilerOptions": { "erasableSyntaxOnly": true } }Your code then runs the same under node file.ts, under Bun, and under a bundler, with no surprises about which subset each one supports.
typescriptnodejs