Hey all! I'm trying to order a set of grouped resu...
# orm-help
g
Hey all! I'm trying to order a set of grouped results by the count of the group, but I'm getting a TS error
Copy code
const statusResults = await prisma.status.groupBy({
      by: ["url"],
      where: {
        AND: {
          userIdStr: {
            in: followIds,
          },
          createdAt: {
            gte: startDate,
          },
        },
      },
      count: {
        url: true,
      },
      // this orderBy doesn't seem to be working.
      orderBy: {
        count: {
          url: "desc",
        },
      },
      having: {
        url: {
          count: {
            gt: 1,
          },
        },
      },
    });
Error:
Copy code
TSError: ⨯ Unable to compile TypeScript:
script.ts:88:9 - error TS2322: Type '{ count: { url: string; }; }' is not assignable to type 'Enumerable<StatusOrderByInput> | undefined'.
  Object literal may only specify known properties, and 'count' does not exist in type 'Enumerable<StatusOrderByInput>'.
I'm attempting to follow the example shown here and can't figure out where I'm going wrong. Thanks!
1