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

Duplicate identifier in generated types #17118

Closed
itsgiacoliketaco opened this issue Jan 3, 2023 · 2 comments
Closed

Duplicate identifier in generated types #17118

itsgiacoliketaco opened this issue Jan 3, 2023 · 2 comments
Labels
kind/bug A reported bug.

Comments

@itsgiacoliketaco
Copy link

Bug description

Given the following schema, Prisma 4.8 will generate two different type MemberRoleArgs lines in .prisma/client/index.d.ts. The first MemberRoleArgs type corresponds with the MemberRole model. The second type corresponds with the Member.role field.

model Member {
  id String @id
  role MemberRole? @relation(fields: [roleId], references: [id])
  roleId String?
}

model MemberRole {
  id String @id
  members Member[]
}

This issue is new as of Prisma 4.8.0; it does not affect 4.7.0 or below.

How to reproduce

  1. Use the above prisma schema.
  2. Run prisma generate
  3. Run tsc --noEmit
  4. See TypeScript error:
    error TS2300: Duplicate identifier 'MemberRoleArgs'
    

Expected behavior

Prisma always generates unique identifiers for helper types.

Perhaps the type for Member.role could be named Member_RoleArgs instead!

Prisma information

Minimal Prisma schema to produce this error is given above.

Environment & setup

  • OS: macOS
  • Database: PostgreSQL
  • Node.js version: 16.15.1

Prisma Version

4.8.0
@itsgiacoliketaco itsgiacoliketaco added the kind/bug A reported bug. label Jan 3, 2023
@jkomyno
Copy link
Contributor

jkomyno commented Jan 4, 2023

Hi @itsgiacoliketaco, closing this is as a duplicate of #17005. This was indeed a regression introduced in prisma@4.8.0 that should be fixed by the next release

@jkomyno jkomyno closed this as completed Jan 4, 2023
@itsgiacoliketaco
Copy link
Author

Great news, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

2 participants