If I try to use a inputTypeObjectType as a field for another inputObjectType like this:
export const ObjWithName = inputObjectType({
name: 'ObjWithName',
definition(t) {
t.string('name');
},
});
export const RootType = inputObjectType({
name: 'RootType',
definition(t) {
t.field('obj', {type: ObjWithName});
},
});
I get this error:
Error:(39, 21) TS2322: Type 'NexusInputObjectTypeDef<"ObjWithName">' is not assignable to type "Boolean" | "Float" | "ID" | "Int" | "JSON" | "String"'.
Type 'NexusInputObjectTypeDef<"ObjWithName">' is not assignable to type '"String"'.
But I don't het this error if I try the same thing with objectType:
export const ObjWithName = objectType({
name: 'ObjWithName',
definition(t) {
t.string('name');
},
});
export const RootType = objectType({
name: 'RootType',
definition(t) {
t.field('obj', {type: ObjWithName});
},
});
I tried playing around with the type here to look more like this. But I couldn't make it work to make a PR x.x
Thanks!
Cool, I agree this should work, will investigate!
I'm facing the same issue. Thanks @tgriesser in advance!
Fixed & released in 0.11
Most helpful comment
Fixed & released in 0.11