libtypescript
v0.0.1
Published
Native, in-process build of the TypeScript compiler. In active development.
Maintainers
Readme
libtypescript
libtypescript is a C++ build of typescript-go, Microsoft's TypeScript 7 compiler, packaged as a library that anyone can embed: in-process in Node.js/Bun/Deno, in any language via C ABI, in the browser via WASM. Compiled from Microsoft's source, not rewritten.
It is also a drop-in replacement for TypeScript 7's compiler CLI (tsc/tsgo): same
commands, same flags, same output, at native speed. Install libtypescript and you get the
TS7 compiler you already use, plus the embeddable APIs it never had.
TypeScript 7 just made every custom transformer incompatible, and its new API ~600x slower. We bring them back, faster than ever.
The Go compiler is 10x faster, but it now lives in a child process behind an RPC API (7.1):
measured against @typescript/api built from typescript-go HEAD, tsgo re-parses a 9 MB file in
0.37 ms, then takes 246 ms to hand you the result. That tax is paid by everyone who
embeds the compiler: transformer authors (the ts-patch ecosystem), vue-tsc, typescript-eslint's
type-aware rules, Angular's ngtsc, editors. typia's answer was a full Go rewrite; most
maintainers can't take that path. libtypescript removes the tax instead:
- In-process for Node / Bun / Deno. Zero-copy AST views + V8 fast calls. ~200x faster API calls than the official 7.1 RPC API. Still 2.4x faster than the classic pure-JS compiler API, at 3x less memory.
ts.*compat layer. The classic TypeScript 6 compiler API (frozen forever now) on top of the TS7 engine. Transformers, checker-based tooling and ts-patch-style plugins run again.- Embeddable everywhere. C/C++ API and WASM. Parse, resolve and instantiate TypeScript types from Python, Rust, Java, Go, C#; validate data and emit JSON Schema. TypeScript as the schema language, JSON Schema as a compile target.
- Same compiler by construction. Mechanically compiled from typescript-go, not a reimplementation. New TypeScript release, new recompile.
Independent open-source project, not affiliated with or endorsed by Microsoft. "TypeScript" is a trademark of Microsoft Corporation; the compiler source is Apache-2.0.
