RBXScriptSignal should be a generic type

Currently, it is too difficult to correctly typecast the Event property on BindableEvent objects.

Right now there are two implementations we can approach

  • using RBXScriptSignal as is, which means you lose autocomplete in the function when another script attempts to use the event
  • creating a close pair with RBXScriptSignal that provides the information, however, it creates typecasting errors and you lose automatic API upgrades

Many libraries utilise the Event part of BIndableEvent to provide a RBXScriptSignal surface for events, even the legacy chat service has, however, none of these libraries are able to properly cast their events in a way thats 1, seamless, 2 friendly to the user with autocompletes.

If Roblox were to address this issue it would improve my development experience as I’d be able to create libraries and objects with RBXScriptSignal types that are properly casted to show what data is sent through the event.

Design Idea

RBXScriptSignal<T...> = {Connect: (T...) -> () --and so on


Being able to typecheck custom RBXScriptSignals would be nice, but I don’t think it would be intuitive to put individual callback methods like in your design considering callbacks will always get the same arguments and should return void.

Perhaps adding syntax some way to apply the generic onto the RBXScriptSignal directly? I don’t know if that makes sense since I’m still figuring out generics.

local Event: RBXScriptSignal<A: number, B: string> = Bindable.Event

Bumping to see if this is even remotely being considered— it would be such a great QoL update, and it seems the Type-Checker is fully capable of doing this already with internal events. It would just be a matter of making the type syntax work.