scriptc and the End of the TypeScript Runtime
How Vercel Labs is compiling ordinary TypeScript into native binaries, using QuickJS only as an island when static lowering runs out of road.
- Scriptc’s central idea is not faster TypeScript, but selective runtime removal, with static code, QuickJS islands, and explicit rejection forming one execution model.
- The compiler’s real challenge is not lowering syntax alone, but making the TypeScript checker fast enough to sit in the middle of a native compilation pipeline.
- Its fallback strategy is the product strategy, because compatibility matters more than purity when the npm ecosystem still contains plenty of untyped code.
- The project reframes TypeScript as a source language for binaries and CLIs, not just an input to a JavaScript engine.
scriptc tries to remove the runtime, not just shrink it
Most TypeScript tools promise a smaller deployable artifact. scriptc goes after something harsher: the runtime itself. It wants ordinary TypeScript, but it only keeps the parts it can safely lower into native code.
That is why the project’s core idea is not “compile TS to native.” It is “route each piece of TS to the cheapest safe execution lane.” When the compiler can prove the path, it emits native code. When it cannot, it may drop into QuickJS. When neither is safe, it rejects the construct with a specific diagnostic.
I compiled 𝚟𝚎𝚛𝚌𝚎𝚕 CLI TypeScript to native with 𝚜𝚌𝚛𝚒𝚙𝚝𝚌. Incredible. ✓ Resulting binary size: 1.28mb ✓ Startup overhead: 1.5ms (mean) ✓ Compiles in 2.94s (mean) ✓ Uses 𝚗𝚘𝚍𝚎:𝚑𝚝𝚝𝚙𝚜, 𝚗𝚘𝚍𝚎:𝚏𝚜, 𝚗𝚘𝚍𝚎:𝚙𝚊𝚝𝚑, 𝚗𝚘𝚍𝚎:𝚘𝚜, 𝚗𝚘𝚍𝚎:𝚌𝚛𝚢𝚙𝚝𝚘 https
The real product is a three-lane execution model
| Model | Runtime included? | Compatibility strategy | Fallback behavior | Developer tradeoff |
|---|---|---|---|---|
| scriptc | No, unless needed | Static lowering first, QuickJS island second | Rejected constructs get explicit diagnostics | Native binaries with selective escape hatches |
| Node.js / Bun | Yes | Broad runtime compatibility | No fallback needed because the VM is always there | Maximum ecosystem coverage, heavier startup and size |
| AssemblyScript | No | Subset-first discipline | Unsupported language features are outside the model | Cleaner compilation, narrower TypeScript surface |
| Porffor | No | Spec-oriented execution | Different compatibility philosophy, no embedded general runtime | Strong “no runtime” story, less Node-shaped compatibility |
| Go / Zig | No | Native binary baseline | Not a TS compiler model at all | Great systems fit, but you leave TypeScript behind |
This comparison is the useful frame. Scriptc is not trying to beat Node at being Node, and it is not trying to out-purity AssemblyScript or Porffor. It is trying to make ordinary TypeScript usable when you care about startup time, binary size, and deployment shape.
Why the compiler is fast enough to be useful
The hard part is not codegen. It is sitting on top of the TypeScript compiler API without drowning in overhead. Scriptc’s frontend uses a custom ts7 adapter, batching, and memoization so the checker becomes a serviceable dependency instead of the bottleneck.
That matters because the compiler is doing more than syntax translation. It is repeatedly asking the TypeScript type system questions, then turning those answers into routing decisions. If that loop is slow, the whole product collapses into a research demo.
// The point is not the syntax, but the compile-time evaluation boundary.
const port = comptime(() => process.env.PORT ?? "3000");
export function main() {
return `listening on ${port}`;
}
Lowering TypeScript into a typed IR changes the rules
The lowering pipeline is where the project stops looking like a wrapper around tsc and starts looking like a compiler. TypeScript is converted into a typed intermediate representation, including nodes that know whether they can become native code, need a dynamic island, or should be rejected.
That design choice is subtle but important. Instead of treating unsupported code as a dead end, the compiler can keep going and build a coverage report. The result is broader insight into a codebase, not just a yes or no answer.
It also explains the project’s stance on type safety. In scriptc, a cast is not just documentation. It is something the runtime can verify at the boundary, which turns the compiler into a contract enforcer rather than a blind transporter of type annotations.
The fallback is the bet
The fallback is not a compromise the project tries to hide. It is the strategic move. Most projects in this space choose one of two uncomfortable extremes: enforce a tiny subset, or ship a full JavaScript engine. Scriptc chooses a third option.
That third option matters because the npm ecosystem is messy. Untyped JavaScript still exists everywhere. A selective island model gives scriptc a way to keep moving through that mess without pretending the ecosystem has already become perfectly typed.
| Approach | What it optimizes for | What it gives up | What scriptc does differently |
|---|---|---|---|
| Runtime-first | Compatibility | Binary size and startup cost | Keeps runtime off the main path |
| Subset-first | Static guarantees | Ecosystem breadth | Accepts more TypeScript and quarantines the rest |
| No-runtime purism | Simplicity of story | Practical compatibility | Uses QuickJS only where the compiler needs an escape hatch |
| Generic native language | Performance and tooling maturity | TypeScript developer workflow | Keeps TypeScript as the source language |
That is also why the project feels more like a systems design argument than a syntax compiler. It is saying that the runtime should be treated as a scarce resource, not an assumption.
What scriptc suggests about TypeScript’s future
The deeper implication is not that TypeScript replaces Rust or Go. It is that TypeScript can sometimes be treated as a source language for binaries, CLIs, and narrow services without dragging a full VM behind it.
That is a different future from the one most JavaScript-adjacent tools have assumed. In that future, the compiler is not just a type checker with output. It is an execution planner, deciding which code deserves native treatment and which code needs a contained fallback.
If scriptc holds up, the interesting question stops being whether TypeScript can run everywhere. It becomes where the runtime is actually worth paying for.





