Hi all, I think I have found a bug in the Typescri...
# orm-help
d
Hi all, I think I have found a bug in the Typescript client, but wanted to ask here if I am doing things right before I go to the trouble of opening an issue. I have the code here:``` notifications: { subscribe: async (root, args, context: IntResolverContext, info): Promise<AsyncIterator<Notification>> => { const { db, id } = context; return db.$subscribe.notification({ where: { AND: [ { mutation_in: ["CREATED"] }, // the notification was just created, rather than updated or deleted { node: { user: { id, // filter for notifications where the user has the current id }, }, }, ], }, // typescript seems to be broken here 😠 } as any).node(); }, },
Copy code
If I don't cast the argument `any` then I get the error ```Argument of type '{ where: { AND: ({ mutation_in: string[]; } | { node: { user: { id: string; }; }; })[]; }; }' is not assignable to parameter of type 'NotificationSubscriptionWhereInput'.
  Object literal may only specify known properties, and 'where' does not exist in type 'NotificationSubscriptionWhereInput'
The code works as it is now even with the error. If I take away the
where
property, and just make the
AND
as the first key then I get no typescript error but the code will not work. Maybe the generated types are incorrect? Also possible I'm just using the library wrong.
n
hey @dieff, what's your Prisma Client version? Here's a PR that sounds related, which was merged and released to
1.19
yesterday.