TypeScript Execution Models
All @connectum/* packages ship compiled ESM JavaScript, declarations, and source maps. Your application can therefore choose how to execute its own TypeScript without loading Connectum through a custom register hook.
For supported versions, feature coverage, and known limitations, use the canonical Runtime Compatibility matrix.
Native Node.js Type Stripping
The current development baseline can execute erasable TypeScript directly:
node src/index.ts
node --watch src/index.tsThis path requires the syntax and import rules in Erasable Syntax. tsc --noEmit still performs type checking; Node.js removes types but does not type-check the program.
Bun
Bun can execute the same application sources directly:
bun src/index.ts
bun --watch src/index.tsUse runtime variants in task guides where a command or limitation genuinely differs. Do not assume Node.js-only OpenTelemetry auto-instrumentation works under Bun; check Runtime Compatibility.
tsx on the Consumer Node.js Line
Applications on the supported consumer Node.js line can execute TypeScript with tsx instead of relying on native type stripping:
npx tsx src/index.ts
npx tsx watch src/index.tsInstall tsx as a development dependency for repeatable project scripts. This choice changes how application source is executed; it does not change the compiled format of Connectum packages.
Choose an Execution Model
| Need | Use |
|---|---|
| Match Connectum's native-TypeScript development workflow | Native Node.js type stripping |
| Run and test the application on Bun | Bun, after checking the compatibility matrix |
| Stay on the consumer Node.js line while executing TypeScript source | tsx |
| Publish a compiled application artifact | Your normal ESM build pipeline |
Generated import extensions must match the project's buf.gen.yaml and execution model. The Quickstart executes generated TypeScript directly and therefore uses .ts; compiled distributions normally generate imports for their emitted .js.
Related
- Runtime Compatibility — supported versions and limitations
- Erasable Syntax — native type-stripping constraints
- Proto Enums — generation when enums require transformation
- Patterns and Workflow — project conventions