Brifing

Vercel's Scriptc: Compiles TypeScript to Native Code

Fast and small executables without a JavaScript engine.

Hacker News: Front Page1 min

1Compiling TypeScript to Native Code

Scriptc transforms TypeScript code into native executables without requiring Node.js or the V8 engine. This enables applications to start faster and use less memory. For example, a Fibonacci calculation can start in just 2ms.

2No Code Changes Required

Scriptc works with your existing TypeScript code without modifications. It compiles the same TypeScript you run on Node.js and produces byte-for-byte identical results. This allows developers to gain performance without changing their infrastructure.

3Static and Dynamic Compilation

Scriptc analyzes your code to determine which parts can be compiled statically. For dynamic parts, it uses the QuickJS engine. In both cases, the safety and correctness of your code are guaranteed. Errors are reported as catchable TypeErrors at runtime.

4Broad Language and Library Support

Scriptc supports most TypeScript language features and standard libraries. Classes, closures, generics, async/await, exception handling, and more can be compiled to native code. It also supports Node.js APIs and npm packages.

5Accuracy and Performance

Scriptc runs differential tests and memory safety checks on every change. In performance tests, it offers startup times 20x faster than Node.js. Binary sizes range from 170-200KB, which is significantly smaller than traditional solutions.

6Future and Potential

Scriptc could be a significant step forward in the TypeScript ecosystem. It is particularly useful for high-performance applications and edge computing scenarios. Vercel is expected to further develop this technology.

Original article: Hacker News: Front Page — Vercel'in Scriptc'si: TypeScript'i Yerel Kodlara Dönüştürüyor