tapioca
tapioca copied to clipboard
`find_in_batches` return type is wrong
Hi! Here, the return type for find_in_batches is set as T::Enumerator[T::Enumerator[A]], but I believe the actual return type is T::Enumerator[T::Array[A]].
This is implied in the documentation:
Yields each batch of records that was found by the find options as an array.
And I've checked this at runtime:
MyModel.find_in_batches.map do |batch|
T.let(batch, T::Enumerator[MyModel]) # This fails
end
This is with Tapioca 0.16.11, Sorbet 0.5.11934, and Rails 8.1.0.alpha.
@dshearer Thanks for the report! We'd be happy to review a PR fixing this issue if you have time to look into it.
Hi @egiurleo , I'd like to take a crack at this if it is still available?
@drewhoffer Sorry for the slow response -- yes! Go ahead.