I just released PolymorphicBelongsTo, a Ruby gem to safely define polymorphic belongs_to associations. It relies on Sorbet + Tapioca.
Currently, without this gem, Tapioca returns T.untyped on polymorphic associations. This gem wraps belongs_to with some custom behavior, some validations, and a Tapioca compiler.
It’s brand new, literally created this today, but I’m already using it in a Rails project of mine. Hope you find it helpful!