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

Client extensions doesn't generate correct select type #16569

Closed
anton-g opened this issue Dec 1, 2022 · 1 comment
Closed

Client extensions doesn't generate correct select type #16569

anton-g opened this issue Dec 1, 2022 · 1 comment

Comments

@anton-g
Copy link

anton-g commented Dec 1, 2022

Bug description

It seems to be an issue with fields named type though! As soon as we add clientExtensions to the preview features and regenerate our types, we get a TS error for one of our models.

Type '{ type: true; }' is not assignable to type 'InterviewSelect<DefaultArgs>'.
  Object literal may only specify known properties, and 'type' does not exist in type 'InterviewSelect<DefaultArgs>'.

88       type: true,
         ~~~~~~~~~~

    at createTSError (/Users/anton/dev/aw/recruit/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/Users/anton/dev/aw/recruit/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/Users/anton/dev/aw/recruit/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/Users/anton/dev/aw/recruit/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/Users/anton/dev/aw/recruit/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/anton/dev/aw/recruit/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  diagnosticCodes: [ 2322 ]
}

Prisma information

model Interview {
  id        String   @id @default(uuid()) @db.Uuid
  ...
  type         InterviewType
  ...
  
  @@map("interview")
}

enum InterviewType {
  screening
  interview

  @@map("interview_type")
}
  const interview = await prisma.interview.findMany({
    select: {
      type: true,
    },
  })

Environment & setup

  • OS: macOS
  • Database: PostgresSQL
  • Node.js version: v16.14.2

Prisma Version

4.7.0
@SevInf
Copy link
Contributor

SevInf commented Dec 1, 2022

Hey @anton-g! Thank you for the report. We already have an earlier report for the same bug (#16535). Fix will be published as a part of 4.8.1 release. I am going to close this issue as a duplicate, let's continue discussion in #16535.

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

No branches or pull requests

3 participants