Hey,
Before installing @prisma/[email protected] and [email protected], I used to get a <Collection>GetSelectPayload for every model.
I used to use it to annotate the arguments to my functions like so:
function checkUserTroup(user: UserGetSelectPayload<{ troups: true }>): boolean {
return !!user.troups.length;
}
Now, @prisma/client doesn't have any export called UserGetSelectPayload. So I tried this approach:
function checkUserTroup(user: UserGetPayload<UserArgs['select']['troups']>): boolean {
return !!user.troups.length;
}
But this doesn't work and I get the following errors, which are fairly understandable:

My question is, is there any replacement for *GetSelectPayload?
Thank you for creating this issue 馃憤
So indeed UserGetSelectPayload was exported before and documented here but disappeared after the dynamic client changes by @timsuchanek
Now there is indeed UserGetPayload
I don't know any replacement or workaround yet, @timsuchanek will be the best person for that but he's on holiday at the moment. We'll get back as soon as possible 馃槂
Hey @samrith-s, thanks for opening this issue. I just updated the docs. This is how the new type UserGetPayload can be used:
import { UserGetPayload } from "@prisma/client";
// Define a type that includes the relation to `Post`
type UserWithPosts = UserGetPayload<{
include: { posts: true }
}>
// Define a type that only contains a subset of the scalar fields
type UserPersonalData = UserGetPayload<{
select: { email: true; name: true }
}>
Gotcha, thanks! 馃槃
Most helpful comment
Hey @samrith-s, thanks for opening this issue. I just updated the docs. This is how the new type
UserGetPayloadcan be used: