Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FindManyBy return type error #1014

Closed
corentinclichy opened this issue Mar 16, 2024 · 2 comments
Closed

FindManyBy return type error #1014

corentinclichy opened this issue Mar 16, 2024 · 2 comments
Assignees
Labels
Priority: Low Something worth considering, but not a top priority for the team Type: Bug The issue has indentified a bug

Comments

@corentinclichy
Copy link

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 of Comission[]

like we have when doing classic findBy()

Reproduction repo

No response

@CodingDive
Copy link

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

findManyBy<T extends LucidModel>(

@RomainLanz
Copy link
Member

Yeah, we have to dig a bit this one, I will see if I have time tomorrow morning.

@RomainLanz RomainLanz self-assigned this Mar 24, 2024
@RomainLanz RomainLanz added Type: Bug The issue has indentified a bug Priority: Low Something worth considering, but not a top priority for the team labels Mar 24, 2024
kingIwan added a commit to kingIwan/Full-stack-res that referenced this issue Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low Something worth considering, but not a top priority for the team Type: Bug The issue has indentified a bug
Projects
None yet
Development

No branches or pull requests

3 participants