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