This page lists known workflow issues with roblox-ts.
All files must be modules when the '--isolatedModules' flag is provided
Therefore, the solution here is to ensure that every file in your project has at least one
export statement. If you don’t need either, then you can provide an empty export statement:
Unfortunately, there is no other workaround for this problem. Please do not remove the
isolatedModules flag from your tsconfig file, as this does not fix the problem, it only suppresses the error.
Unrestricted File Access and Auto-Imports
Any file in your project has the ability to import any given module file. You can also auto-import files in VS Code by attempting to reference an exported member of a given module.
ModuleScript inside of
game.ServerStorage should not be accessible by a
Objects May Only Have String Keys
In TypeScript, objects may only have string keys, and arrays may only have numerical keys. This contrasts heavily with the wild west of Lua tables, where the keys can be mixed and of any type. In roblox-ts (and TypeScript), we can solve this problem by using a
Map object. Maps are objects that hold arbitrary key-value pairs of data. They also support generic types:
const playerMap = new Map<Player, number>() playerMap.set(somePlayer, 5)
Set is another useful data type that holds a set of unique values. It is akin to an array, but uniqueness is enforced.