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

scripting

#22

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).


#23

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;
print(child2.AnchorPoint);

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.


#24

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.


#25

Thank you for this. Will be very helpful.


#26

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

Requires use of the rbx-roact package.


#27

https://roblox-ts.github.io

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


#28

Can you still override the index/newindex operators?


#29

Yep, just not on class instances.

Regular objects work fine.


#30

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

thanks to a ton of work by @evaera