jcmais / nexus-plugins Goto Github PK
View Code? Open in Web Editor NEWA collection of plugins for nexus https://github.com/graphql-nexus/schema
License: MIT License
A collection of plugins for nexus https://github.com/graphql-nexus/schema
License: MIT License
Since updating to @jcm/nexus-plugin-relay-mutation
0.1.2, TypeScript types generated by Nexus do not align with the actual input argument passed to mutateAndGetPayload
.
For example, if I created a Relay mutation as follows
t.relayMutation('foo', {
inputFields(it) {
it.nonNull.string('bar');
},
outputFields(ot) {
ot.nonNull.string('baz');
},
mutateAndGetPayload(_root, inputFields) {
return {baz: inputFields.bar};
},
});
TypeScript will expect the type of inputFields
to be
inputFields: {
input: {
baz: string;
clientMutationId?: string | null | undefined;
};
}
meanwhile the actual type is
inputFields: {
baz: string;
clientMutationId?: string | null | undefined;
}
Hi there,
I might be wrong, but I now replace my custom published package with 0.2.0 because I assumed the optional config param was resolved with that version. It should contain the fix merged with #4 . But it doesn't.
Did something go wrong when you published the package?
When I use the plugin and define id as a relayGlobalId field, it results in a type error stating that "id" is not found on the object. If I use the model ID instead of relay (uncomment line below), there is no type error, but the id is obviously not relay-compliant. I'm not sure if this is related to graphql-nexus/nexus#36 (see comment), but is there any way to get nexus to realize the id does exist on the root type?
const Task = objectType({
name: TaskModel.$name,
definition: (t) => {
t.implements('Node')
t.relayGlobalId('id', {})
// t.field(TaskModel.id.name, TaskModel.id)
t.connectionField('comments', {
type: 'Comment',
resolve: async (src, args, ctx, info) => {
const comments = db.comment.find({
where: {
taskId: src.id, // <==== TypeError Here
},
})
},
})
},
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.