🚀scriptc Compiles TypeScript to Native Binaries
TypeScript now compiles to native code with scriptc
TL;DR
scriptc converts TypeScript into native executables without relying on Node.js. It supports a wide range of language features and standard library functions, ensuring compatibility while offering significant performance improvements.
scriptc compiles ordinary TypeScript code directly into small, fast native binaries that run byte-for-byte like Node.js but with no runtime overhead. This means developers can build applications that start up faster (2.4ms context startup) and use less memory (1-4MB RSS), compared to the 67-116MB used by Node.js. The compiled code behaves identically to TypeScript in Node, making it a drop-in replacement for many workflows. scriptc supports most of TypeScript's language features and standard library functions, ensuring compatibility with existing projects.
Key Points
Installation: npm install -g scriptc; requires clang (Xcode Command Line Tools)
macOS arm64 primary platform; Linux/Windows cross-compiled with differential tests
Static mode compiles code natively, dynamic mode uses embedded JavaScript engine
Supports TypeScript language features like classes, async/await, and more
Node.js API surface supported: fs, path, process, crypto, url/URL, zlib
Why It Matters
If you're building performance-critical applications in TypeScript, scriptc offers a way to compile your code into native binaries that start up faster (2.4ms) and use less memory (1-4MB RSS). This is particularly useful for server-side applications where startup time and resource usage are critical.
Frequently Asked Questions
Why does this matter?
If you're building performance-critical applications in TypeScript, scriptc offers a way to compile your code into native binaries that start up faster (2.4ms) and use less memory (1-4MB RSS). This is particularly useful for server-side applications where startup time and resource usage are critical.
What happened?
scriptc converts TypeScript into native executables without relying on Node.js. It supports a wide range of language features and standard library functions, ensuring compatibility while offering significant performance improvements.
Comments
Be the first to comment
Enjoyed this article?
Get it daily. 7am. Free. Reads in 5 minutes.
Join 2,310 builders reading daily.