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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prisma Client: fixing type name clashes from generated client #19811

Closed
Jolg42 opened this issue Jun 16, 2023 · 1 comment
Closed

Prisma Client: fixing type name clashes from generated client #19811

Jolg42 opened this issue Jun 16, 2023 · 1 comment
Assignees
Labels
kind/improvement An improvement to existing feature and code. team/client Issue for team Client. tech/typescript Issue for tech TypeScript. topic: client types Types in Prisma Client topic: prisma5 topic: type-clash topic: typescript
Milestone

Comments

@Jolg42
Copy link
Member

Jolg42 commented Jun 16, 2023

Internal Slack 馃У
Internal Notion doc

During type generation, we create many different TS types based on a schema. Sometimes, generated type clashes with some other model type or internal helper type we are using. In that case, generated client usually becomes unusable.

List of open issues with type-clash) topic label

  1. Introduce $Model namespace for user-defined models, enums and composites
  2. Introduce sub-namespaces for generated types
  3. Move all helpers into the runtime module

Notes

  • No changes required from the users for the most part. For the types that might actually be used on their projects, we keep an alias with a short name as an export if it does not conflict with other models. We remove it if it has a conflict, but that鈥檚 already broken. So, I don鈥檛 think it is possible to get from working project to non-working one with this change.
  • We should at least mention that Prisma.SomeModelArgs is now available as Prisma.$SomeModel.Args as well. If we decide that we want to recommend it (since it would never conflict with anything) we might specify that too and deprecate the old thing.
  • in order for it to work, we need to ensure that only fully-qualified names are used by the client itself.
@Jolg42 Jolg42 added kind/improvement An improvement to existing feature and code. topic: client types Types in Prisma Client tech/typescript Issue for tech TypeScript. team/client Issue for team Client. topic: type-clash topic: prisma5 topic: typescript labels Jun 16, 2023
@Jolg42 Jolg42 added this to the 5.0.0 milestone Jun 16, 2023
@Jolg42 Jolg42 removed this from the 5.0.0 milestone Jul 12, 2023
@janpio janpio added this to the 5.1.0 milestone Jul 12, 2023
@SevInf
Copy link
Contributor

SevInf commented Jul 20, 2023

All clashes except #15718 should be fixed in 5.1. That one can not be fixed in backward-compatible manner and have to wait until next major release.

@SevInf SevInf closed this as completed Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/improvement An improvement to existing feature and code. team/client Issue for team Client. tech/typescript Issue for tech TypeScript. topic: client types Types in Prisma Client topic: prisma5 topic: type-clash topic: typescript
Projects
None yet
Development

No branches or pull requests

3 participants