TS error when JSON field in Prisma - Type instantiation is excessively deep
error seen here
find
prisma schema
const field = trpc.field.find.useQuery({
documentId: props.docId,
path: props.fieldName,
})
field.data?.value
/*
Type instantiation is excessively deep and possibly infinite.
(property) value: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | ... 4 more ... | null)[] | Record<...> | null)[] | Record<...> | null)[] | Record<...> | null)[] | Record<...> | null)[] | Record<...> | null)[] | Record<...> | null | undefined
*/ const field = trpc.field.find.useQuery({
documentId: props.docId,
path: props.fieldName,
})
field.data?.value
/*
Type instantiation is excessively deep and possibly infinite.
(property) value: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | ... 4 more ... | null)[] | Record<...> | null)[] | Record<...> | null)[] | Record<...> | null)[] | Record<...> | null)[] | Record<...> | null)[] | Record<...> | null | undefined
*/find
export const fieldRouter = t.router({
find: t.procedure
.input(
z.object({
documentId: z.string(),
path: z.string(),
})
)
.query(async ({ input: { documentId, path } }) => {
return db.field.findFirst({
where: {
documentId,
path,
},
select: {
value: true,
},
})
}),export const fieldRouter = t.router({
find: t.procedure
.input(
z.object({
documentId: z.string(),
path: z.string(),
})
)
.query(async ({ input: { documentId, path } }) => {
return db.field.findFirst({
where: {
documentId,
path,
},
select: {
value: true,
},
})
}),prisma schema
model Field {
documentId String
path String
value Json
document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
@@id([documentId, path])
}model Field {
documentId String
path String
value Json
document Document @relation(fields: [documentId], references: [id], onDelete: Cascade)
@@id([documentId, path])
}