I'm trying to apply typing to a repo that uses the Sequel gem. It's got a non-standard Ruby syntax for a particular use case: initializing a model when a table name doesn't follow a convention
Example:
# This is necessary to get around
# "Superclasses must only contain constant literals"
FooParent = Sequel::Model(:foo_bars)
class Foo < FooParent
end
I've been able to tell Sorbet that certain attributes exist on my Foo model with this code in sorbet/rbi/shims/foo.rbi
# Raises an error:
# "Redefining constant `FooModelParent`"
class FooParent < Sequel::Model
end
This makes errors such as "Method join
does not exist on T.class_of(Foo)
7003" go away, but I'm not sure how to get rid of this "Redefining Constant" error or if there's a better way. Can someone help me get rid of this error, or solve the inheritance typing problem a different way?