Need help with joined tables

Hi,
I have some relations in my data schema. I have the type "questionnaire" which is linked to an entity called project:
entity Questionnaire {=psl id String @id @default(uuid()) ... project Project? @relation(fields: [projectId], references: [id]) projectId Int? ... psl=}

That works fine in the database as I can observe in the db studio.

In mein queries.ts I made this query:

export const getQuestionnaires: GetQuestionnaires<void, Questionnaire[]> = async (_args, context) => { if (!context.user) { throw new HttpError(401); } return context.entities.Questionnaire.findMany({ where: { userId: context.user.id }, **include: { project: true,** }, orderBy: { createdAt: 'desc', }, }); };

That also works fine. In a console log, I perfectly see my project object as part of my questionnaire array. (see screenshot)

Now the problem (see second screenshot): when I iterate over this array, IDE says that there is an issue with the type.
I am not even sure if its an WASP issue or a simple TS/React thing where I fail to solve.

Thank you for your help πŸ™‚
image.png
image.png
Was this page helpful?