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

[BUG] Incorrect casing in generated Prisma types #1815

Closed
1 task
SaswatB opened this issue Mar 22, 2022 · 4 comments · Fixed by #1846
Closed
1 task

[BUG] Incorrect casing in generated Prisma types #1815

SaswatB opened this issue Mar 22, 2022 · 4 comments · Fixed by #1846

Comments

@SaswatB
Copy link

SaswatB commented Mar 22, 2022

Information

  • Version: 5.x
  • Packages: @tsed/prisma

When using lowercase model names in Prisma, the repository types generated by @tsed/prisma have incorrect casing on the aggregate parameter which results in broken types.
Prisma's behavior is likely caused by this line:
https://github.com/prisma/prisma/blob/f35af40ffed4cc96d990ab26c96d99c5f104c178/packages/client/src/generation/utils.ts#L134

Example

model user {
  id            String
}
#13 12.77 node_modules/.prisma/client/entities/repositories/userRepository.d.ts(18,28): error TS2724: '"/app/node_modules/.prisma/client/index".Prisma' has no exported member named 'userAggregateArgs'. Did you mean 'UserAggregateArgs'?

Acceptance criteria

  • @tsed/prisma should generate valid types
@Romakita
Copy link
Collaborator

Romakita commented Mar 22, 2022

By convention, Ts.ED use a pascal case for model and it seems to be the same thing for prisma.

The problem seems to be here: https://github.com/tsedio/tsed/blob/production/packages/orm/prisma/src/generator/transform/transformModelToClass.ts#L7

@Romakita
Copy link
Collaborator

export function capitalize(str: string): string {
  return str[0].toUpperCase() + str.slice(1)
}

@Romakita
Copy link
Collaborator

Romakita commented Apr 7, 2022

🎉 This issue has been resolved in version 6.110.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Romakita
Copy link
Collaborator

🎉 This issue has been resolved in version 7.0.0-beta.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants