Greg Egan
08/20/2020, 9:51 PMmodel BrandCategory {
id String @id
title String
hero String?
brands Brand[]
}
const BrandCategory = objectType({
name: "BrandCategory",
definition(t) {
t.string("id");
t.string("title");
t.string("hero", {
nullable: true,
});
t.list.field("brands", {
type: "Brand",
resolve: (parent) =>
prisma.brandCategory
.findOne({
where: { id: String(parent.id) },
})
.brands(),
});
},
});
Hi all - i'm getting typescript errors on my relational BrandCategory <-> Brand object. ANy idea what I need to do to handle this PromiseLike / MaybePromise issue?
Type 'Promise<Brand[]>' is not assignable to type 'PromiseLike<{...}>
Type 'Promise<Brand[]>' is not assignable to type 'MaybePromise<{...}>
Joël
await
to prisma.brandCategory....
Greg Egan
08/26/2020, 2:45 AM