This is a bug report after this discussion here.
With the following code and using the new type solver:
type Arg = "Hi" | "Player" | "Okay" | "Test"
type Task = typeof({
buff = function(self: Task)
end,
start = function(self: Task)
end,
destroy = function(self: Task)
end,
})
type Command = {
name: string,
aliases: {string}?,
args: {Arg},
prefixes: {string}?,
autoPreview: boolean?,
revokeRepeats: boolean?,
cooldown: number?,
run: (task: Task) -> ()
}
-- COMMANDS
local commands: {Command} = {
--------------------
{
name = "dance",
aliases = {"dce"},
args = {"Player", "Okay"},
prefixes = {"/", "@"},
cooldown = 123,
run = function(task)
end,
},
--------------------
{
name = "fly",
aliases = {"ccc2"},
args = {"Player", "Test"},
},
--------------------
}
-- RETURN
return commands
It’s currently impossible to have the parameter ‘task’ within the function ‘run’ auto complete without defining the Task type for every command, whereas this is possible in the old solver.
For example:
-
Current setup, less desirable, but working:
run = function(task: Task) end, -
Desired setup, but not working:
run = function(task) end,
All the other auto competes work as expected (args, cooldown, name, etc).
It’s not necessary, but being able to do (2) would greatly help organise and reduce duplicate code with the new type solver.