-
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
Usage of generated typescript types / general typescript questions #28
Comments
With Nexus the idea is that you shouldn't ever need to annotate types in the resolver as you are doing above. By configuring the makeSchema's The
If you want to get the resolver typing, for use elsewhere, for instance if you wanted to move your resolve fn into its own file, we export a FieldResolver helper.
It should be typed? Where are you seeing that it isn't?
Once you have the root types setup with the generator, the root types and return types shouldn't be "any" anymore, they should be correct based on what the field is resolving with. In order to see the types for the root, args, ctx, you can right click on the type and click "go to type definition". I map this to |
One quick suggestion here: I have put the main interface at the top of the file in the generated typings of |
I'm using
nexus
in a typescript-based graphql server and have a few questions in regard to typing this correctly, sorted in order of (subjective) importance:Promise<Project>
instead ofPromise<any>
? Typescript types are auto-generated, but i'm confused about the way to use them (i'd want to use them on both server (resolver return value) and client). Also, based on the docs, i don't understand thetypegenConfig
andtypegenAutoConfig
parameters ofmakeSchema
at all - the ghost example doesn't help either. I assume these configuration options have something to do with the usage of the generated typescript types.info
parameter of the resolver have no type information?root
parameter?The text was updated successfully, but these errors were encountered: