"roblox-ts" - a TypeScript-to-Lua Compiler for Roblox

Does this have type information about what’s in the game tree? It would be useful to know the names and types of children of Workspace et al. Also if this information could be preserved for clone()'s, that would be really useful for things that use a lot of prefabs (i.e. GUIs).

Automatically, no. We do not take any data from Roblox Studio, so we cannot statically know the layout of your game.

In general, this is good. It makes your code more portable to not assume anything about the structure of a game.

But if you wanted this behavior, it’s pretty easy to hack it together like:

import { ReplicatedStorage } from "rbx-services";

type MyFramePrefab = Frame & {
	Child1: Frame & {
		Child2: Frame;

const frame = ReplicatedStorage.MyPrefabFrame.Clone() as MyFramePrefab;

const child2 = frame.Child1.Child2;

Using as you make an assertion to the compiler about the structure of the object.

This isn’t too different than Lua. It’s just more explicit. You’re making assertions of what you think the object is when you use properties/call methods in Lua.


Kinda sad that something like this isn’t already built-in to the platform. Yes, Lua is an easy-to-learn language. That doesn’t mean we can’t step it up a notch or two and add an alternative language.

Excellent work; will definitely use this.


Thank you for this. Will be very helpful.


Just merged in support for Roact with JSX thanks to a ton of work from @Vorlias.

Requires use of the rbx-roact package.



Huge update to our project website thanks to @evaera !
Works much better on mobile now.


Can you still override the index/newindex operators?

Yep, just not on class instances.

Regular objects work fine.

1 Like

We’ve cleaned up our documentation and moved it to the project site!

thanks to a ton of work by @evaera



Just published roblox-ts 0.0.23 and rbx-types 1.0.113
This is a breaking change and you’ll need to update existing code to make it work properly!

Going forward, creating Instances with the syntax new Part() will no longer work.
Instead, you should use new Instance("Part")
In addition, the instanceof operator will no longer work for data types (i.e. Vector3, UDim2, etc.) or for Instances.

To replace the functionality of instanceof, I’ve added a new built-in function:
typeIs(value: any, typeName: string): boolean
It’s equivalent to going typeof(value) == typeName, but allows for type narrowing in TypeScript.
For example:

// v is some unknown data
if (typeIs(v, "Vector3")) {
    print(v.X, v.Y, v.Z); // v is a Vector3

This works for any given type you might want to use with Roblox’s typeof() function: nil, boolean, number, string, table, Vector3, BrickColor3, Instance, etc.

If you wanted to know if a given value is a particular type of Instance, you could use typeIs in conjunction with .IsA():

if (typeIs(v, "Instance") && v.IsA("BasePart")) {
    print(v.Size); // v is a BasePart

Wow! This is definitely helpful with my future developments. Thanks!


@Crazyman32 has a cool video showing this off if anyone is interested


I’ve been obsessed with this package, and I learned typescript so I could use it. However, when I initially tried this is was confusing due to all the compiler bugs and issues. When I can use my computer, I will try it out since I’m super excited to make a game using this. (I would imagine that most of the bugs would be fixed by summer.)


I was spending so much time writing debugging and type checking code, that I finally decided to ditch the vanilla roblox ide and am now using Rojo & Robloxts!

Wondering what I need to do for Plugin development. From a quick and non-thorough observation, I believe things with PluginSecurity were not generated by rbx-types. eg. Selection.Get(): Instance[] // API says Object, assuming its an instance array
Is there a supported method for getting/generating these? I found some filters in the Generators (shouldGenerateMember), that I look configurable, but I have no clue where from.

Also, how would I go about adding/editing things manually for when generation fails me? Currently, I am editing the rbx-types/include directly in my project, but I thought there might be a more proper way to override them.


Unfortunately, we don’t support plugin development yet. It’s planned, we just need to solve a few problems first. Namely, supplying a different rbx-types for plugins and figuring out what to do with the runtime library.

Glad to hear you’re interested. If you’d like to follow progress, we actively discuss changes on the discord.


I’m excited to announce that we now support plugin development!


Plugins must be created using the “bundle” configuration.
You can find some info about that here.

And you can find a bundle configuration template here:

Every file using plugin APIs must start with

/// <reference types="@rbxts/types/plugin"/>



roblox-ts now has an online playground you can use to demo the compiler without installing anything!

Try hovering over things like “FindFirstChild”!



Out of curiosity - would this kind of programming be more “realistic”? As someone who’s looking to enter the programming industry whilst only “professionally” working in Roblox Lua, when I moved onto C# and C++, I noticed the way everything was programmed was quiet different. I understand Roblox Lua may be tailored to make it easier to use due to the generally young players who may wish to learn to code - does this mean that “real” coding is much different?

After looking at your playground and trying to change constant to variable, I failed miserably (The heck is “let”??), so if this is the case, I think it would be better for me to learn this now, though if it isn’t, I can live without the headache for at least the next 3 years. :smile:

I definitely recommend not starting with this if you aren’t experienced with Lua already.

The goal is to make Roblox development with complex projects a bit easier by providing static type checking. However, you’re still writing Lua, it just doesn’t look like Lua. You need to have a decent grasp on the mechanics of Lua to effectively use this project.

It’s also still very experimental and not well documented. I hope within a few months it’ll all be a bit more fleshed out and stable.

Alright - thanks for the reply.

I’d like to think I’m experienced with Lua, since I’ve been doing this for 5 years, though I don’t think the first three count since I was just learning how to use for loops :laughing:

I noticed you’re a Roblox Intern, does this mean that roblox-ts has a chance to become “official” once it’s more “stable” and more “well documented”?