TypeScript with Node type stripping
- Deciders: David Bauer, Julian Bäume
- Date: 2026-06-12
Status
Accepted
Context
Booking re-implements the Java booking-service on the web-foundation stack. Node.js (≥22, and more completely ≥24) can execute .ts files directly by stripping type annotations at load time, without a compilation step, as long as the code avoids TypeScript-only runtime features (enums with values, decorators needing metadata, namespace merging into runtime objects).
We want TypeScript's type checking and editor tooling without adding a build/watch step to a service this size.
Decision
Run source directly with node src/index.ts (dev: node --watch --watch-preserve-output src/index.ts), using Node's native type stripping. tsc --build is typecheck-only (noEmit: true, composite: true project references between src/, test/, integration/) and is not part of the run or start path. No bundler, no dist/ for the backend. Imports use explicit .ts extensions (rewriteRelativeImportExtensions: true lets tsc accept them while Node's loader resolves them natively). erasableSyntaxOnly: true is set so the compiler flags any construct type-stripping can't erase, before it becomes a runtime surprise.
Vite remains the build tool for the two frontends (ui-plugin, ui-poll), which are genuinely bundled, browser-facing apps - this decision is backend-only.
Consequences
Positive
- Zero backend build step: what you edit is what runs, in dev and in the container image alike.
- Full TypeScript type checking and IDE support via
tsc --build, decoupled from execution. - Faster inner loop than a compile-then-run or bundle-then-run cycle.
Negative
- A few TypeScript features are unavailable (const enums with computed values, legacy decorators, certain
namespacepatterns) -erasableSyntaxOnlycatches violations at typecheck time rather than at runtime, but the constraint still shapes what's idiomatic. - Explicit
.tsextensions on relative imports are required, which is unfamiliar friction for anyone coming from bundler-based TypeScript. - Slightly less mature tooling ecosystem than a fully compiled setup; debugging maps directly to source, but some third-party tooling still assumes a
dist/output.
References
- Node.js type stripping documentation

