While the default for T we have (number | string | bigint) makes sense, it should be possible to override T as an arbitrary type, rather than restricting it with extends number | string | bigint.
This is because users can customize the JS type representations at the driver layer, which in my case was using Decimal.js for decimal types.
However, since the fn.sum<T>() function didn't accept bigint | Decimal as T, it resulted in a type error.
Though debatable, I personally think that removing the type parameter restriction is the right thing to do.
While the default for
Twe have (number | string | bigint) makes sense, it should be possible to overrideTas an arbitrary type, rather than restricting it withextends number | string | bigint.This is because users can customize the JS type representations at the driver layer, which in my case was using Decimal.js for decimal types.
However, since the
fn.sum<T>()function didn't acceptbigint | DecimalasT, it resulted in a type error.Though debatable, I personally think that removing the type parameter restriction is the right thing to do.