ts2gd is a TypeScript-to-GDScript transpiler for Godot 3.x projects, currently at version 0.0.36. It compiles TypeScript source files directly to GDScript with near-zero runtime overhead and fast incremental compilation (<0.1 seconds after startup). Unlike embedded JavaScript runtimes (e.g., GodotJS), ts2gd outputs native GDScript, ensuring no performance penalty. It enhances developer experience with full TypeScript type safety, autocomplete, and refactoring support. The project is in early beta with occasional breaking changes due to its pre-1.0 status. Development appears active, with updates every few months.
npm install ts2gdNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Installs ts2gd globally, initializes a Godot project, writes a basic TypeScript script, and compiles it to GDScript.
Import the scene global directly (e.g., `import { MySceneTscn } from "godot"`) and use `instance()` instead of `preload()`Use `EnumName.Property` syntax; see generated `@globals.d.ts` for full list
Declare `$my_signal!: Signal` (use `!` to avoid TS uninitialized error)
Add `@autoload` decorator to class, then `export const MyAutoload = new MyAutoloadClass()`
Call `this.methodName.rpc(arg)` instead of `this.rpc("methodName", arg)`Upgrade Godot to 3.3 or later, or avoid autoload exports
Lock version in package.json, test compilations after updates
Import KeyList from 'godot': `import { KeyList } from 'godot'`If using a built-in signal, ensure the class extends the correct node type; for custom signals, declare `$my_signal!: Signal`
Run `ts2gd --init` to scaffold project and generate types, or run `ts2gd --buildOnly` to generate `@globals.d.ts`
Add `@remote` or `@remotesync` decorator to the method
No dependency data recorded yet.