luau2ts
A Luau-to-TypeScript compiler for Roblox.
roblox-ts compiles TypeScript to Luau. luau2ts compiles the other direction: it takes Luau (or Lua) source code and emits idiomatic, readable TypeScript.
Why?
There are three real use cases:
-
Migrate an existing Luau codebase to TypeScript. You have a place with hand-written
.luauscripts, and you want type safety, IDE refactoring, and the broader TS toolchain. Runluau2tsonce on the whole project, hand-tune the output, ship in TS from then on. -
Round-trip with
roblox-ts. A single Luau source can compile throughluau2tsto TS, and back throughroblox-tsto Luau. The two compilers are intentionally compatible at the TS layer. -
Run authored Luau through TS-native tooling. Type-check, lint, test, and debug Luau game logic using the same TypeScript tooling you use for everything else.
What you get
- A small CLI (
luau2ts) that compiles a single file, a directory tree, or a Rojo project. - A library API (
import { compile } from 'luau2ts') for embedding the compiler in build pipelines. - A
--mode rbxtsemit that drops straight into a roblox-ts project. - A
--mode nativeemit that imports stdlib helpers fromluau2ts/runtime. - Two-layer type checking (
--typecheck): TypeScript's checker on the output and Luau's checker on the input. - 100% Luau conformance against the upstream test suite.
- Source maps that point each emitted TS statement back to the original
.luauline.
Next
- Quick start, install and compile your first file.
- Setup guide, longer walkthrough including Rojo project mode.
- CLI usage, full flag reference.