MAY 7, 2025

TypeScript: Godot's Most Powerful Scripting Language

Benjamin Dobell
Benjamin Dobell
Founder of Breaka Club

TypeScript is Godot's most powerful scripting language.

Superior Auto-complete

GodotJS' TypeScript integration allows you to contextually autocomplete:

  • Node paths
  • Resource names
  • Animation names
  • Input actions

Node path completion

GodotJS generates the necessary information and contains built-in utility types to contextually auto-complete node path references.

Node path completion

The completion is contextual, above we auto-completed from the root node in a scene. Let's auto-complete from a node nested further down in the scene hierarchy.

Node path completion relative

Resource completion

You have access to all resources in your Godot project:

Resource completion

You can leverage the types GodotJS generates for you to define project-specific types. Here's an example of a type that requires a texture resource path:

Specific resource completion

Animation completion

Typos, begone. You can play animations with confidence they're defined on the target node. That's right, again the animation names you're presented with are context aware and only pertain to the target AnimationPlayer.

Animation completion

Input action completion

Your project action map is scanned, and will auto-complete for relevant APIs:

Action name completion

Superior Type Safety

Honestly, this one isn't really fair. Type safety is TypeScript's bread and butter. Built into the language, it has the chops to contextually infer and narrow types through-out a codebase.

Auto-complete is great, but the way the above examples work is that they're fundamentally context aware. We don't just know the names of scene nodes, we know their types, too. You'll be notified in real-time as you code if a node does not match the expected type:

Assignment checking

The error above sheds some light on how TypeScript's type system works i.e. Its type checking is structural rather than nominal (a.k.a. duck typing).

TypeScript's type system is extremely powerful and far exceeds the capabilities of both GDScript and C#. If the latter comes as a surprise to you, consider node path auto-completion in the examples above.

We're not generating a list of relative node strings for every single node in every single scene. We represent the node hierarchy just the once, and TypeScript is able to generate related types.

If you want to give yourself a headache, feel free to check out the types I wrote for the get_node() / getNode() API. ResolvePath will be of particular interest.

Or perhaps not. You don't have to understand these types to benefit from them!

Naturally, you're not restricted to utilizing the types GodotJS provides for you. The real power of TypeScript is that it allows you to accurately model your domain and enforce correct usage:

Your types

So I should be using TypeScript?

I mean. I didn't say that. 😅

Sigh! A catch? Why is there always a catch?

Aside from the obvious, in that GDScript and C# are both officially supported, and TypeScript is a third-party integration. GodotJS is still pretty raw in some places.

I've personally been focused on improving the ergonomics of GodotJS. Everything documented above are my own contributions. There's still a lot more that I could do.

Firstly, I could improve the types a lot more.

Then there's the camel-case Godot API bindings, which are another contribution of mine. This can be toggled on/off. There's likely some teething issues with it. However, in the same way that Godot's C# integration utilizes convention abiding naming, I think it's worth the effort to fit in nicely with the JavaScript ecosystem.

Beyond my own contributions, Alex, the creator of GodotJS, has poured many hours into supporting a host of runtime solutions. This isn't a TypeScript to GDScript transpilation layer, you've a real JavaScript runtime at your finger tips.

Actually, you have several. GodotJS supports V8, QuickJS, JavaScriptCore and regular web exports i.e. whatever your browser is running right now. Naturally, there's some complexity here, and some platforms are better supported than others.

That said, GodotJS is already pretty fantastic, and it's continuously being improved. Game development takes time. If you start a new game today, it's likely you won't be releasing for over 12 months. My apologies if that comes as a shock.

We're using it!

Here at Breaka Club we're using GodotJS to build software that turns kids from consumers into creators. We're still in stealth mode, but if you're a parent (or a kid?) then feel free to poke around.

If you're reading this and haven't watched the video above, jump toward the end to get a sneak peak of what we're building; both in and outside of Godot. 😉

Since we're using GodotJS and plan to target web, mobile and desktop, we'll continue making contributions that improve the project.

We'll also be releasing source code for much of what we build. If that's something that resonates, please join our Discord.

Check out GodotJS

Note: To get the latest, you need to compile from source. Compilation tip