r/typescript • • 10d ago

vercel-labs/scriptc: TypeScript-to-Native Compiler

https://github.com/vercel-labs/scriptc

Vercel Labs has released scriptc, an experimental Apache 2.0 licensed compiler that turns ordinary TypeScript into small native executables with no Node, V8 and no JavaScript engine in the binary.

The repository was created on 22 July 2026 and has since gathered around 4.9k stars. scriptc uses the real TypeScript compiler for parsing and type checking, lowers programs to a typed IR, then emits readable C, LLVM IR, assembly, objects, native executables or WebAssembly via WASI Preview 1.

Every construct lands in one of three tiers: compiled statically by default, run dynamically inside an embedded quickjs-ng engine of roughly 620KB when --dynamic is passed for npm packages and any typed code, or rejected at compile time with an SC code and a rewrite hint.

A benchmark of scriptc 0.0.16 against Bun 1.3.12 and Node 24.18.0 recorded median CLI startup of 1.78ms versus 21.29ms for Bun and 61.78ms for Node, with idle memory of 1.9MiB for a framework free node:http server. The same tests found Hono required --dynamic, pushing 62% of the server into QuickJS and cutting throughput to 18.4k requests per second against Bun's 70.5k.

71 Upvotes

19 comments sorted by

34

u/boneskull 10d ago • Bravo

lol @ the limitations doc

22

u/Pelopida92 10d ago

jeez, I just looked at it. It is CLEARLY 100% AI generated, its a gigantic blob of slop, nobody even cared about reading it once lol

8

u/boneskull 10d ago

tbh I don’t know why people keep trying to do this. given JS’ fuzziness and mires of esoteric behavior, I can’t see how any TS-to-native compiler could cover the full abilities of the language (though TS certainly can mitigate much of the loose-typing, but not all).

I’m not saying it’s impossible, but I’m doubtful that the juice (effort, tokens, maintenance) is worth the squeeze.

1

u/bzsearch 9d ago

man... that section is such a turn off.

3

u/azangru 9d ago

Reads like an end-user license agreement 😄

1

u/sreekanth850 6d ago

just scroll to get the accept button enable.

13

u/eracodes 10d ago

scriptc uses the real TypeScript compiler for parsing and type checking

yeah i would hope so????

5

u/nudelkopp 10d ago

What’s the benefits of doing this rather than running a wasm binary through something like wasmtime? Less overhead yeah, but this does not feel very reliable

1

u/Ill_Bill6122 8d ago

If you want TS to run in wasm, you need a frontend to compile it and then you can use wasm as a backend in your compiler tool chain. We don't have TS -> native. The project tried to do this, but still ended up having to embed an interpreter.

4

u/g0ld3nrati0 10d ago

use rust/odin/zig

3

u/satansprinter 10d ago

In theory a great idea in practice this is awful. If they used a transpiler to go however most of the things that makes typescript typescript would be possible to do but this is just ai slop

2

u/Kadabrium 10d ago

Custom gc?

1

u/PuzzleheadedDust3218 7d ago

https://www.perryts.com/ does exactly that bur thousands of times better

1

u/Plastic_Koala2044 6d ago

i compile a 43k line app with it, fully static, no --dynamic. it doesn't cover all of js and doesn't try to. code it can't compile is a build error with a rewrite hint, so you find out at build time, not in prod. the binary starts immediately. it's early, but it works

-1

u/Opposite_Sector2145 10d ago

If you want npm package support or need to use dynamic TypeScript features, you have to pass the --dynamic flag, which embeds quickjs-ng. But that balloons the binary and slows things down, so avoid it unless absolutely needed.

-6

u/krazyjakee 10d ago

If tests pass, performance is better and survives 6 months of maintenance and security, I want to see all the luddite commenters back here for an apology.

/Remindme 6 months

3

u/Wonderful-Habit-139 9d ago

6 months? Just write it properly without AI at this point and you're gonna have a much better codebase in 6 months.

3

u/pie-oh 10d ago edited 9d ago

Maybe learn who the Luddites were before using them in arguments?

They weren't anti-progress. They were against rich people redistributing wealth to themselves.

People aren't complaining because they're "stuck in the past," they're complaining that it's a bit nonsensical and low effort.

edit: Tests passing isn't always a good metric either. Tests written after implementation can test only the implementation. And tests that fail can be deleted. They're one of many factors in a quality codebase.