Urgent.News

What's breaking now, across thousands of outlets.

Tech

ScriptC: Vercel's Experimental Native TypeScript Compiler

TypeScript has conquered web development, backend microservices, and command-line tooling. Yet, despite its expressive static type system, TypeScript has always remained an interpreted guest inside the JavaScript ecosystem. Every time you deploy a TypeScript CLI or microservice, you are forced to package an entire JavaScript runtime: Node.js, Deno, or Bun. This introduces inevitable tradeoffs:…

TypeScript has become a dominant force in web development, backend services, and command-line tools. However, deploying a TypeScript project often requires bundling a JavaScript runtime like Node.js, leading to substantial overhead in terms of startup time, binary size, and memory usage. Vercel Labs has introduced ScriptC, an open-source compiler that aims to resolve these issues by enabling TypeScript to function as a standalone, ahead-of-time (AOT) compiled language.

ScriptC operates through a multi-stage compilation pipeline: it first leverages the official TypeScript compiler for parsing and type checking, then proceeds to lower the AST into intermediate representations including typed JSON, readable C, LLVM IR, native machine code, and WebAssembly. This hierarchical compilation process offers several advantages.

First, it enables truly static builds where the binary starts up in microseconds and consumes minimal memory, without the need for a full JavaScript runtime. Second, ScriptC can translate standard Node.js APIs into native system calls, facilitating the creation of high-performance native binaries. Third, it includes a diagnostic tool to report code compatibility and highlight dynamic aspects that require reflection.

Finally, ScriptC supports cross-compilation to WebAssembly via WASI, allowing for portability across various environments.

To use ScriptC, developers install it globally with npm and then compile their TypeScript files using the `scriptc build` command, specifying the output filename. The resulting binary can be executed directly on any compatible machine, without the need for Node.js or V8. While ScriptC is still in its experimental phase, it represents a significant step forward in making TypeScript a viable standalone language for a wide range of applications, from CLI tools to microservices.

The project's GitHub repository and license information are available for those interested in exploring its capabilities further.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Sunday 27 September →