You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following error is raised on the object:method(123) line:
TypeError: Type 'Class' from 'example.lua' could not be converted into 'Class' from 'example.lua'
caused by:
Property 'method' is not compatible.
Type
'(Class, number) -> number'
could not be converted into
'<T>(Class, T) -> T'; different number of generic type parameters
Impact
You don't even have to call the method in order to experience the issue. For example, your template method could be buried in a descendant class:
typeClass= { method: <T>(Class, T) ->T }
typeParent= {
child: Class,
foo: (Parent) -> (),
}
localparents: { Parent } = {}
for_, parentinparentsdoparent:foo() -- 'Parent' could not be converted into 'Parent'end
This, and the nonsense message, makes the error very frustrating.
This makes the code look very silly, since object is already a Class. It is also somewhat challenging to come up with this workaround on your own, and it's likely that people are just casting object :: any and destroying type safety.
For some additional context, I've been complaining about this in the Roblox OSS Discord for a while.
The text was updated successfully, but these errors were encountered:
Reproduction
For example, in this code:
The following error is raised on the
object:method(123)
line:Impact
You don't even have to call the
method
in order to experience the issue. For example, your template method could be buried in a descendant class:This, and the nonsense message, makes the error very frustrating.
Workaround
This makes the code look very silly, since
object
is already aClass
. It is also somewhat challenging to come up with this workaround on your own, and it's likely that people are just castingobject :: any
and destroying type safety.For some additional context, I've been complaining about this in the Roblox OSS Discord for a while.
The text was updated successfully, but these errors were encountered: