-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mutation args and return types are of type any #892
Comments
I have been carefully looking at the issue, I think I must have been to quick in building up my schema and missed some imports. I was referencing the input types directly in my mutations, which it is not enough on its own. |
So this took me a long time to try to solve, but this got my type safety for arguments. I had custom scalars
Which were defined as any in the generated typegen file To solve this in your
This achieved type safety for me |
Oh yes @100AD ! I noticed that too, without the mapping you won't have type safety on those fields. I am going to close this issue soon, I am pretty sure that what was going wrong was my own fault. Mainly to do with having missed to export/import my input types properly. @tgriesser could be interesting maybe to be able to not have to import input types ( or object types that are returned in Mutations ) if they are used in a Mutation directly. |
Usually you just need to open the generated file for the typing to be picked-up, not much we can do |
Can this be resolved with zod to ensure type safety?? |
I don't think I am doing anything particularly wrong, but I don't have types for mutation args and return type in the resolve function.
See example below ( what is actually hovered is not the actual issue, the args within the resolve function are of type any, the root type is any and also the return type )
The
nexus-typegen.ts
file is successfully generated.I have generated all my code from the sdl converter, now I am starting again to scratch to see if I can work out what is that breaks the typescript type reflection.
The text was updated successfully, but these errors were encountered: