# ts2gd: Compile TypeScript to GDScript ⚠️ Need help? Contact me on Discord: johnfn#0001. ## Why use ts2gd? - Compiles directly to GDScript with virtually no performance penalty - no embedded JS runtime. - Insanely fast dev experience - after startup, incremental compiles take under a tenth of a second. - Provides crazy good autocomplete and documentation. - Use all of TS's extremely powerful type system. ## Install: `npm install --global ts2gd` Then just run `ts2gd` in your favorite Godot project folder. ![](readme/output.gif) ## Why? GDScript is a great language - it's perfectly designed for quick prototyping. But it lacks the type-safety and maturity of a language like TypeScript. By compiling TS into GD, we can get the best of both worlds: a rapid prototyping language that compiles virtually instantaneously, that also comes with excellent typesafety. We can also get really, really good autocomplete and refactoring support. ## Usage To initialize a new project: ``` ts2gd --init ``` To watch TS files for changes and automatically compile them to GDScript: `ts2gd` To compile all source files once: `ts2gd --buildOnly` ## Details and Differences ### `get_node` `get_node` has been supercharged - it will now autocomplete the names of all child nodes. And yes, this means that if you arrange your nodes later, you'll get type errors if you break any `get_node` calls!! | Godot hierarchy | ts2gd autocomplete | | :----------------------------: | :-----------------------------------: | | ![](readme/get_node_godot.png) | ![](readme/get_node_autocomplete.png) | ts2gd also provides a way to get any node by name, even the ones it can't verify exist: ``` this.get_node