Skip to main content

Introduction

What is roblox-ts?#

In short, roblox-ts is a way to use the tooling and ecosystem surrounding TypeScript for Roblox development. This includes intellisense, IDE extensions, linters, code formatters, and more! It allows you to write TypeScript code that is then compiled into Luau code for use inside of Roblox.

roblox-ts works with both TypeScript files (.ts) and Luau files (.lua) which are paired with TypeScript type definition files (.d.ts).

Typings for the Roblox API are partially handwritten and partially automatically generated from the Roblox API dump and Developer Hub documentation.

Features#

  • Write TypeScript code, run it in Roblox
  • Automatic project structure setup for creating games, models, plugins, and packages
  • Automatically generated type definitions for the Roblox API
  • Infers the structure of your game using your Rojo configuration file
  • Use VSCode's intellisense, autocompletion, and type checking abilities
  • Use industry standard tools for linting and formatting like ESLint and Prettier
  • Growing collection of NPM packages
  • TypeScript Transformer Plugins

Why should you use roblox-ts?#

roblox-ts is great for managing large scale projects. Static types and intellisense allow you and your IDE to understand what your code is doing on a deeper level without having to mentally track what's going on. TypeScript's typing system allows you to clearly describe what each function expects as inputs and gives back as an output.

roblox-ts, TypeScript, and most of the related tooling is open source! This means you can hack it, tweak it, and customize it to your liking. roblox-ts supports TypeScript transformer plugins which allow you to modify the behavior of the compiler itself! You can also write your own ESLint plugins to enforce certain rules on your code.

Why should you not use roblox-ts?#

The biggest downside to using roblox-ts is debugging. When you use the Roblox Studio debugger (or when you encounter an error), you will see the compiled Luau code instead of TypeScript code. While we actively work to make the compiled Luau code as readable as possible, this does still introduce a bit of complexity. Usually, it's pretty easy to mentally map your compiled Luau code to your TypeScript code.

The silver lining here is that the remaining few bugs should be logical bugs anyway!

Learning Resources#

Need help?

Feel free to ask us questions in our Discord server's #help channel!