Open connorshea opened 5 years ago
This is certainly a tricky one. I'm not too familiar with how type_member
works, but my understanding is that, for an array, Elem
should be set to the type of each element in the array. Is there any way this could be determined through YARD, or would we just use T.untyped
?
Probably just T.untyped.
T.untyped
should work as a stop-gap solution here.
Elem = type_member(fixed: T.untyped)
Is your feature request related to a problem? Please describe. A lot of the remaining errors returned by
rake examples:typecheck
are to do with classes descending from Array or Struct, and thus needing to have theElem
constant redeclared.Describe the solution you'd like The simplest solution would be to just define the necessary constants for each parent class that needs this (Array, Struct, etc.), but that's somewhat fragile. I'm not sure if there's a way for us to determine what Sorbet wants us to add when generating the rbi file?
I suppose these constants wouldn't change very often for core classes like this, so it may be fine to just handle it on a case-by-case basis in Sord.
Describe alternatives you've considered I'd prefer if Sorbet magically fixed this itself, but I don't think it can :(