Closed corentinclichy closed 6 months ago
I'm running into the same issue. You can fix it in user land by passing the type of your model as a type argument explicitly.
const commissions = await Commission.findManyBy<typeof Commision>('userId', user.id)
I'm unsure why the type is not inferred automatically correctly. Code looks pretty similar as the other lucid methods that work smoothly https://github.com/adonisjs/lucid/blob/196c97c580b0f5327f6330f8b799169f02571adc/src/types/model.ts#L1001
Yeah, we have to dig a bit this one, I will see if I have time tomorrow morning.
Package version
20.4.0
Describe the bug
Hello,
When trying to user findManyBy, for example:
const commissions = await Commission.findManyBy('userId', user.id)
the return type of commissions is:
LucidRow[]
instend ofComission[]
like we have when doing classic
findBy()
Reproduction repo
No response