You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently the typescript-operations plugin allows me to use the import-types preset and with preResolvesTypes to generate operation types which pick from existing types (generated elsewhere). I would like to have this same behavior when using the client preset.
Describe the solution you'd like
I would like to be able to specify preResolveTypes: false and provide a typesPath (same as currently available for import-types preset) when using the client preset. When set the client preset should not generate new top level operation types but should instead pick from the imported types from the typesPath (again same as is currently setup with import-types)
This all works great but we currently rely on the types generated by gql-tag-operations in the client preset to types the gql queries we write e.g. gql(query { stuff { id } }) has a return type of a TypedDocumentNode (rather than just the document node when using apollos gql function).
Is your feature request related to a problem? Please describe.
I think the most ideal solution to me is client is extended to support importing types. Alternative better documentation on the gql-tag-operations might make sense as it might be a simple to plugin that in? Equally I could just be missing a simple fix for what I'm trying to do so any help if much appreciated.
The text was updated successfully, but these errors were encountered:
Also in the documentation it currently states you can provide a list of presets
generates.preset - A list of presets to use for the output. Presets are a way to dynamically create the list of output files based on the input schema. near-operation-file-preset is a good example
Is that correct? I haven't seen any examples of this and couldn't understand how this would work but if that's the case it might be ideal?
Is your feature request related to a problem? Please describe.
Currently the
typescript-operations
plugin allows me to use theimport-types
preset and withpreResolvesTypes
to generate operation types which pick from existing types (generated elsewhere). I would like to have this same behavior when using the client preset.Describe the solution you'd like
I would like to be able to specify
preResolveTypes: false
and provide atypesPath
(same as currently available for import-types preset) when using the client preset. When set the client preset should not generate new top level operation types but should instead pick from the imported types from the typesPath (again same as is currently setup with import-types)Describe alternatives you've considered
I have tried to use a combination of existing plugins to get the same behavior as client but with imported types. This has almost worked but the missing piece is generating the
gql
function which the client function is doing with the currently undocumented gql-tag-operations (https://github.com/dotansimha/graphql-code-generator/blob/master/packages/plugins/typescript/gql-tag-operations/src/index.ts).My current config has the following components which successfully generates the types (with a custom plugin on the original schema types).
This all works great but we currently rely on the types generated by gql-tag-operations in the client preset to types the gql queries we write e.g.
gql(
query { stuff { id } })
has a return type of a TypedDocumentNode (rather than just the document node when using apollos gql function).I considered using this gql-tag-operations plugin but was unsure how to generate the
SourceWithOperations
object which is handled here in the client preset: https://github.com/dotansimha/graphql-code-generator/blob/master/packages/presets/client/src/process-sources.ts.Is your feature request related to a problem? Please describe.
I think the most ideal solution to me is client is extended to support importing types. Alternative better documentation on the
gql-tag-operations
might make sense as it might be a simple to plugin that in? Equally I could just be missing a simple fix for what I'm trying to do so any help if much appreciated.The text was updated successfully, but these errors were encountered: