Skip to content

selectRelationCount generator doesn't add _count to Prisma.validator #7688

Closed

Description

@SamuelMS

The selectRelationCount preview feature in #6312 works well, but the _count field doesn't seem to be supported by Prisma.validator and Prisma.XYZGetPayload for partial / related types.

// works fine
const user = Prisma.validator<Prisma.UserArgs>()({
  select: { id: true, name: true },
});
export type User = Prisma.UserGetPayload<typeof user>;

// TS2322: Type 'boolean' is not assignable to type 'never'.
const userWithCount = Prisma.validator<Prisma.UserArgs>()({
  select: { id: true, name: true, _count: { select: { posts: true } },  },
});

Activity

  1. SamuelMS commented on Jun 20, 2021

    @SamuelMS
    Author

    Disregard; the generator is working correctly, I was referencing a stale file.

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

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