In the following sample, the first argument when connecting the OnServerEvent signal is correctly typed as Player:
declare class Player extends Instance
end
declare class RemoteEvent extends BaseRemoteEvent
OnClientEvent: RBXScriptSignal<...any>
OnServerEvent: RBXScriptSignal<(Player, ...any)>
function FireAllClients(self, ...: any): ()
function FireClient(self, player: Player, ...: any): ()
function FireServer(self, ...: any): ()
end
In the following sample, the first argument is an error-type instead:
declare class RemoteEvent extends BaseRemoteEvent
OnClientEvent: RBXScriptSignal<...any>
OnServerEvent: RBXScriptSignal<(Player, ...any)>
function FireAllClients(self, ...: any): ()
function FireClient(self, player: Player, ...: any): ()
function FireServer(self, ...: any): ()
end
declare class Player extends Instance
end
This is problematic, because using types before declaration like this was allowed in the old solver and is legal in normal Luau files in the new solver. No solver errors are thrown either, the type is just replaced with an errortype. This holds true for things other than the generic arguments in this example; this happens for normal type refs/properties as welll.
In the following sample, the first argument when connecting the OnServerEvent signal is correctly typed as Player:
In the following sample, the first argument is an error-type instead:
This is problematic, because using types before declaration like this was allowed in the old solver and is legal in normal Luau files in the new solver. No solver errors are thrown either, the type is just replaced with an errortype. This holds true for things other than the generic arguments in this example; this happens for normal type refs/properties as welll.