Currently it is Bun-only. You can install it with
bun add -g @kimlikdao/kdts
It has two modes: fast and opt.
- fast mode is a thin wrapper around bun build but supports the same command line arguments as opt mode.
- opt mode uses (a fork of) Google Closure Compiler as a backend to perform type-driven optimizations.
Fast mode should work on most valid TypeScript programs:
kdts entry.ts --fast
In opt mode, the sources need to be accurately typed and written in a small but expressive subset of TypeScript for now. Such programs can be compiled with
kdts entry.ts
It currently compiles our kimlikdao-lib in opt mode, including substantial cryptography and decentralized identity code.
I built kdts while working on kimlikdao-lib, where type-driven optimizations seemed very useful, but writing code for Closure Compiler directly was painful and never seemed to get easier. kdts lets you write code in idiomatic TypeScript while still targeting Closure Compiler for aggressive optimization.
kdts is still under active development, but it is already useful for us on kimlikdao-lib. I’m interested in hearing from others who have codebases where this kind of type-driven optimization could be useful, and what features or workflow support would matter most for adoption.