Fix CollectionService Disallowing Modular Scripting

Look at these 3 line of codes:

local Tags = require(game.ReplicatedStorage.Tags)
local Query = `Folder.{Tags.Round}`
local RoundCollection = game.CollectionService:CreateCollection(Query, workspace)

Type engine infers Query as dynamically generated, and makes RoundCollection’s type any. Only hardcoded string is supported in CollectionService:CreateCollection() for typed returns.

Developers must process strings when modularizing query string, which makes string dynamic, and therefore disables types for collections.

As a Roblox developer, it is currently too hard to maintain scripts with Collections, because developers would have to manually cast as singleton or create a complicated type function when using modules to type query strings.

When addressed, selector’s typing support would make maintaining easier.

Thanks to everyone for listening to my opinions.

6 Likes

This would be nice. I made my own tooling for vscode that adds types to collections; it will likely be a while for the studio editor to catch up.