roblox-ts is not JavaScript
roblox-ts compiles TypeScript to Luau, so the code runs in Roblox, not Node or a browser. The compiler and ESLint catch most differences (null, .length, truthiness, for...in). These they don’t explain:
- There’s no Node, DOM or npm runtime. Use Roblox’s APIs:
task.delayforsetTimeout,printforconsole,HttpService:JSONEncodeforJSON. ForObject.keysand the like,import ObjectUtils from "@rbxts/object-utils". ESLint names the Roblox API for each JavaScript global an agent reaches for. - Packages come from the
@rbxtsscope; a plain npm package won’t run in Roblox. - Check Roblox values with
typeIsandclassIs, and an instance with its children withFlamework.createGuard<T>().
Luau beside TypeScript
Section titled “Luau beside TypeScript”A hand-written .luau module in src/ is copied to out/ as it is, and TypeScript imports it through a .d.ts beside it that declares what it returns. A spec calls it through those types. The check formats such files with StyLua, lints them with Selene and type-checks them with luau-lsp (strict, the new type solver, Roblox’s API types); in a game without any, those steps do nothing.