Renovate-Bot 1f2ef9ab02
Node.js CI / build (18.x) (pull_request) Failing after 23s
Node.js CI / build (20.x) (pull_request) Failing after 23s
Node.js CI / build (22.x) (pull_request) Failing after 17s
Add renovate.json
2026-06-24 14:00:27 +00:00
2026-06-24 15:12:26 +02:00
2026-06-22 21:51:16 +02:00
2025-04-06 19:54:48 +08:00
2025-04-06 18:00:58 +08:00
2025-04-06 18:00:58 +08:00
2026-06-22 21:51:16 +02:00
2025-04-06 19:54:48 +08:00
2025-04-06 19:54:48 +08:00
2026-06-22 21:51:16 +02:00
2025-04-06 20:11:44 +08:00
2026-06-24 14:00:27 +00:00
2025-04-06 19:54:48 +08:00

rbxts-transformer-instances

Enable the use of instance constructors in roblox-ts, reducing boilerplate by letting you use familiar class-like syntax.

Overview

This transformer automatically converts constructor-style instance creation (new Frame()) into the standard Roblox Instance.new("Frame") pattern at compile time.

Features

  • Cleaner syntax for creating instances
  • 🔍 Full TypeScript type safety
  • Zero runtime overhead (transforms at compile-time)
  • 🔄 Supports all creatable Roblox instance types

Installation

npm install rbxts-transformer-instances

Configure in your tsconfig.json

Add the transformer to your tsconfig.json:

{   
    "compilerOptions": {
        ...
        "plugins": [
			{
				"transform": "rbxts-transformer-instances",
			}
		]
    },
    "include": [..., "node_modules/rbxts-transformer-instances"]
}

Usage

Basic Usage

// Instead of this:
const part = new Instance("Part");
part.Material = Enum.Material.Neon;
part.Position = new Vector3(0, 10, 0);

// You can write this:
const part = new Part();
part.Material = Enum.Material.Neon;
part.Position = new Vector3(0, 10, 0);

Examples

Input (TypeScript):

// Creating a basic UI
const screenGui = new ScreenGui();
screenGui.Parent = game.GetService("Players").LocalPlayer!.WaitForChild("PlayerGui");

const frame = new Frame();
frame.Size = new UDim2(0, 200, 0, 200);
frame.Position = new UDim2(0.5, -100, 0.5, -100);
frame.BackgroundColor3 = Color3.fromRGB(45, 45, 45);
frame.Parent = screenGui;

const textLabel = new TextLabel();
textLabel.Size = new UDim2(1, 0, 0, 50);
textLabel.Text = "Hello, World!";
textLabel.Parent = frame;

Output (Lua):

-- Creates standard Instance.new calls
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")

local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 200, 0, 200)
frame.Position = UDim2.new(0.5, -100, 0.5, -100)
frame.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
frame.Parent = screenGui

local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 0, 50)
textLabel.Text = "Hello, World!"
textLabel.Parent = frame

License

MIT

S
Description
No description provided
Readme MIT 231 KiB
Languages
TypeScript 62.2%
JavaScript 37.8%