tapioca icon indicating copy to clipboard operation
tapioca copied to clipboard

use primary key type for ActiveRecord::Calculations#ids return type

Open ebarajas opened this issue 8 months ago • 1 comments

Motivation

This PR updates the built-in Tapioca::Dsl::Compilers::ActiveRecordRelations compiler to add a narrowed type for the return value of #ids. Before this was simply set to Array, so each item in the array was resolving to T.untyped.

Implementation

I duplicated some existing work done for the #find method to determine the type of the primary key column.

Tests

I've updated the existing test to assert the RBI is generated as expected.

ebarajas avatar May 12 '25 20:05 ebarajas

I have signed the CLA!

ebarajas avatar May 12 '25 20:05 ebarajas