Peter
12/02/2020, 2:41 PMnonNullDefaults: {
output: true,
}
to my existing objectType and have error on resolvers in this type
Type '(root: Bts, args: any, ctx: { prisma: PrismaClient<PrismaClientOptions, never>; }) => Prisma__StationIdClient<StationId | null>' is not assignable to type 'FieldResolver<"Bts", "stationId">'.
Type 'Prisma__StationIdClient<StationId | null>' is not assignable to type 'StationId | PromiseLike<StationId> | { id: MaybePromise<number>; name: MaybePromise<string>; } | PromiseLike<StationId | { ...; }>'.
Type 'Prisma__StationIdClient<StationId | null>' is not assignable to type 'PromiseLike<StationId | { id: MaybePromise<number>; name: MaybePromise<string>; }>'.
Types of property 'then' are incompatible.
Type '<TResult1 = StationId | null, TResult2 = never>(onfulfilled?: ((value: StationId | null) => TResult1 | Promise<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | Promise<...>) | ... 1 more ... | undefined) => Promise<...>' is not assignable to type '<TResult1 = StationId | { id: MaybePromise<number>; name: MaybePromise<string>; }, TResult2 = never>(onfulfilled?: ((value: StationId | { id: MaybePromise<number>; name: MaybePromise<...>; }) => TResult1 | PromiseLike<...>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | ... 1 more ...'.
Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.
Types of parameters 'value' and 'value' are incompatible.
Type 'StationId | null' is not assignable to type 'StationId | { id: MaybePromise<number>; name: MaybePromise<string>; }'.
Type 'null' is not assignable to type 'StationId | { id: MaybePromise<number>; name: MaybePromise<string>; }'.
67 resolve(root, args, ctx) {
~~~~~~~
Object look like this
export const Bts = objectType({
name: 'Bts',
description: 'BTS details',
nonNullDefaults: {
output: true,
},
definition(t) {
t.id('id')
t.string('lac'),
t.string('btsid'),
t.string('cid1'),
t.string('ECID'),
t.float('latitude'),
t.float('longitude'),
t.field('provider', {
type: 'Provider',
resolve(root, args, ctx) {
return ctx.prisma.provider.findOne({
where: { id: root.providerId },
})
},
}),
t.field('province', {
type: 'Province',
resolve(root, args, ctx) {
return ctx.prisma.province.findOne({
where: { id: root.provinceId },
})
},
}),
t.field('place', {
type: 'Place',
resolve(root, args, ctx) {
return ctx.prisma.place.findOne({
where: { id: root.placeId },
})
},
}),
t.field('location', {
type: 'Location',
resolve(root, args, ctx) {
return ctx.prisma.location.findOne({
where: { id: root.locationId },
})
},
}),
t.field('technology', {
type: 'Technology',
resolve(root, args, ctx) {
return ctx.prisma.technology.findOne({
where: { id: root.technologyId },
})
},
}),
t.field('frequency', {
type: 'Frequency',
resolve(root, args, ctx) {
return ctx.prisma.frequency.findOne({
where: { id: root.frequencyId },
})
},
}),
t.field('stationId', {
type: 'StationId',
resolve(root, args, ctx) {
return ctx.prisma.stationId.findOne({
where: { id: root.stationIdId },
})
},
})
},
})
and other type that is included here also have nonNullDefaults flag