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

Incorrect type declarations for Prisma logging-middleware event emitters #2052

Closed
realStandal opened this issue Mar 21, 2021 · 3 comments · Fixed by #2415
Closed

Incorrect type declarations for Prisma logging-middleware event emitters #2052

realStandal opened this issue Mar 21, 2021 · 3 comments · Fixed by #2415
Assignees
Labels
bug/confirmed We have confirmed this is a bug topic/logging
Projects

Comments

@realStandal
Copy link
Collaborator

The following is a bug-report for the canary API-side logging.

When using the provided api/src/lib/prisma.ts, the following type-warning is encountered:

Client.$on() error

Where client.$on() takes on the following signature:

client.$on() signature

With the following types being used, as generated by rw prisma generate in node_modules/.prisma/client:

$on() declaration

"U" declaration

@realStandal
Copy link
Collaborator Author

Possibly related to #2053

@dthyresson dthyresson self-assigned this Mar 21, 2021
@dthyresson dthyresson added topic/logging bug/confirmed We have confirmed this is a bug labels Mar 21, 2021
@dthyresson dthyresson changed the title Incorrect type declarations for Prisma logging-middleware Incorrect type declarations for Prisma logging-middleware event emitters Mar 21, 2021
@dthyresson
Copy link
Contributor

I had seen this TS warning, but as yet had not figured out a workaround or solution to find that exact type definition.

This issue gives me some direction, thanks!

@dthyresson
Copy link
Contributor

See: https://github.com/prisma/prisma/blob/1d0045fe60dc1992173f3f5be84b24129f0d45a3/src/packages/client/src/generation/TSClient/PrismaClient.ts#L45

export class PrismaClient<
  T extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions,
  U = 'log' extends keyof T ? T['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<T['log']> : never : never,
  GlobalReject = 'rejectOnNotFound' extends keyof T

@dthyresson dthyresson added this to To do in Logging via automation Mar 23, 2021
@dthyresson dthyresson moved this from To do to v1.0 in Logging Mar 23, 2021
@dthyresson dthyresson moved this from v1.0 to In progress in Logging Apr 30, 2021
@dthyresson dthyresson linked a pull request Apr 30, 2021 that will close this issue
Logging automation moved this from In progress to Done Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/confirmed We have confirmed this is a bug topic/logging
Projects
No open projects
Logging
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants