export type MyType<A... = ()> = {
Fire: (self: MyType<A...>, A...) -> (),
Connect: (self: MyType<A...>, func: (A...) -> ()) -> (),
}
local function New<A...>()
return {} :: MyType<A...>
end
local value = New()
value:Fire("abc", 123)
value:Connect(function(a, b) end)
Expected behavior
i believe the connect function should work in the same way as fire.
it should add onto the type so it should have been number | string | boolean and number | string
and if its unknown it should stay as number | string and number
Hello! Sorry for the delay here. Some of these issues have been fixed, but others are probably not going to be fixed in the new solver:
export type MyType<A... = ()> = {
Fire: (self: MyType<A...>, A...) -> (),
Connect: (self: MyType<A...>, func: (A...) -> ()) -> (),
}
local function New<A...>()
return {} :: MyType<A...>
end
local value = New()
value:Fire("abc")
value:Connect(function(a: boolean)
end)
… this snippet will probably always error in some respect. There’s no type that would work for A... that would allow for both string as an input type to Fire and as the type of the function passed to Connect. boolean would mean we’d error on Fire, string would mean we’d error on Connect, and boolean | string would also mean erroring on Connect.
That being said, for your example where the types are replaced to unknown: