Indirect prisma relations has type errors.
When upgrade to 3.64.0 of @pothos/plugin-prisma, typescript report a type error for every indirect relations. A sample code is below:
export const ConceptNode = builder.prismaNode('Concept', {
description: 'Concept information',
// https://pothos-graphql.dev/docs/plugins/prisma#select-mode-for-types
select: { id: true },
// https://pothos-graphql.dev/docs/plugins/prisma#prismanode
id: { field: 'id' },
fields: t => ({
version: t.exposeString('version', { description: 'Concept version' }),
type: t.expose('type', {
description: 'Concept type',
type: ConceptCategoryEnum,
}),
name: t.exposeString('name', { description: 'Concept name' }),
abbreviation: t.exposeString('abbreviation', { description: 'Concept abbreviation' }),
description: t.exposeString('description', { description: 'Concept description' }),
// https://pothos-graphql.dev/docs/plugins/prisma#indirect-relations-eg-join-tables
superiors: t.field({
description: 'Superior concepts',
select: (args, ctx, nestedSelection) => ({
superiors: {
select: {
superior: nestedSelection(true),
},
},
}),
type: [ConceptNode],
resolve: concept => concept.superiors.map(({ superior }) => superior),
}),
}),
})
The select field of superiors field report error: Type '{ superiors: { select: { superior: true; }; }; }' is not assignable to type 'never'.ts(2322)
Please check this. My whole project can not compile now.
Have you rerun Prisma generate after upgrading?
Yes, I have re-run the generate command.
I haven't been able to replicate this in any of the repos I have that use the Prisma plugin. Is there a reproduction you might be able to share?
Let me know if you are still having issues, but since Ive been unable to reproduce, and haven't gotten any more info here, I am hoping this has been resolved. I'm going to close this out for now.
The issue is disappeared after I installed the latest version, Thanks.