Node.js Type-Stripping Checker
Scan a TypeScript file for syntax Node's built-in type stripping can't run directly
tsc --noEmit in CI regardless.About this tool
Since Node 24 (the 2026 LTS), running node file.ts works out of the box via type stripping — a transform (the amaro module, built on SWC) that erases TypeScript-only syntax and runs the resulting JavaScript directly, with zero type checking performed at runtime. The catch: type stripping can only erase syntax, it can't generate runtime code. A handful of TypeScript features compile to real runtime behavior, not just type annotations — enums (a runtime object), parameter properties (a runtime field assignment hidden in a constructor parameter), namespaces containing actual values (a runtime IIFE), and decorators (runtime metadata/wrapping) — and none of those can be handled by erasure alone. This tool scans a TypeScript file for exactly those four patterns using bracket-aware pattern matching (not a full TypeScript parser — it can misread unusual formatting), so you know before you try node file.ts whether it'll actually run.
When to use it
- →Checking whether an existing TypeScript file can run directly with node file.ts before trying it
- →Understanding why a specific file fails under Node's native TypeScript support with a cryptic runtime error
- →Auditing a codebase before switching local dev scripts from ts-node/tsx to Node's built-in support
- →Learning which TypeScript features compile to real runtime code vs. which are purely type-level and erasable
Tips
- ◆Enums are the most common blocker in real code — switch to a union type plus a plain object (optionally with `as const`) to get similar ergonomics without the runtime enum object.
- ◆Parameter properties (constructor(private x: number) {}) are convenient but not strippable — declare the field explicitly and assign it in the constructor body instead.
- ◆Type stripping performs zero type checking — a file with no findings from this tool can still have real type errors. Keep running tsc --noEmit in CI regardless of whether you use native execution locally.
Frequently asked questions
Is this the same thing as TypeScript 7's new Go compiler?
No, they're unrelated efforts that both matured in 2026. Node's type stripping is a lightweight syntax-erasure transform with no type checking, built into the Node runtime itself. TypeScript 7's Go-based compiler is a real, full type-checking compiler. Many teams use type stripping for fast local scripts and dev iteration, and still run the real TypeScript compiler in CI for actual type safety.
Can I fix a namespace so it works with type stripping?
Yes, if the namespace only declares types and interfaces (no const, function, or class with actual runtime values inside it) — a type-only namespace has nothing to erase incorrectly and works fine. This tool flags any namespace block for manual review since telling the two apart perfectly requires a real parser, not just pattern matching.
Why doesn't Node just support decorators too?
Decorators require actual code generation — wrapping a method, attaching metadata — not just removing type syntax, which is a fundamentally different (and more involved) job than what type stripping is designed to do. Node has separate, opt-in experimental decorator support outside of type stripping if you need them.