Skip to content

'Boolean' is not assignable to type 'boolean' when assigning to Prisma User #47

@defrex

Description

@defrex

Hello,

I'm trying to integrate graphql-authentication into a prisma, 'typescript' & graphql-yoga codebase. It seems pretty strait forward, however the typescript compiler is complaining about Boolean and boolean being incompatible types when comparing the User model from graphql-authentication and the User model from 'prisma'.

Any guidance, or is this a legit bug?

TSError: ⨯ Unable to compile TypeScript:
api/resolvers/Query.ts(6,14): error TS2322: Type '{ env: () => { appName: string; plaidEnv: string; plaidPublicKey: string; }; currentUser(parent: any, args: any, ctx: Context, info: any): Promise<User>; }' is not assignable to type 'Type'.
  Types of property 'currentUser' are incompatible.
    Type '(parent: any, args: any, ctx: Context, info: any) => Promise<User>' is not assignable to type '{ fragment: string; resolve: (parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo) => User | Promise<User>; } | ((parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo) => User | Promise<...>)'.
      Type '(parent: any, args: any, ctx: Context, info: any) => Promise<User>' is not assignable to type '(parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo) => User | Promise<User>'.
        Type 'Promise<User>' is not assignable to type 'User | Promise<User>'.
          Type 'Promise<import("/home/defrex/code/fin/node_modules/graphql-authentication/dist/Adapter").User>' is not assignable to type 'Promise<import("/home/defrex/code/fin/api/gen/prisma-client/index").User>'.
            Type 'import("/home/defrex/code/fin/node_modules/graphql-authentication/dist/Adapter").User' is not assignable to type 'import("/home/defrex/code/fin/api/gen/prisma-client/index").User'.
              Types of property 'inviteAccepted' are incompatible.
                Type 'Boolean' is not assignable to type 'boolean'.
                  'boolean' is a primitive, but 'Boolean' is a wrapper object. Prefer using 'boolean' when possible.

Prisma Model

type User {
  id: ID! @unique
  email: String! @unique
  password: String!
  name: String!
  inviteToken: String
  inviteAccepted: Boolean! @default(value: "true")
  emailConfirmed: Boolean! @default(value: "true")
  emailConfirmToken: String
  resetToken: String
  resetExpires: DateTime
  deletedAt: DateTime
  lastLogin: DateTime
  joinedAt: DateTime!
  isSuper: Boolean! @default(value: "false")

  accounts: [Account!]!
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions