Open Sly777 opened 5 months ago
@graphql-codegen/typescript-graphql-apollo
I want to generate apollo hooks on new version of codegen but when I use client preset with typescript-react-apollo, they got conflict and creates same variables two times. If I don't use client preset, then it asks input - output on all queries.
client
typescript-react-apollo
input - output
example result;
export const ValidateMyPhoneDocument = gql` mutation validateMyPhone($test: String!) { validateMyPhone(test: $test) } ` as unknown as DocumentNode<ValidateMyPhoneMutation, ValidateMyPhoneMutationVariables>; export const ValidateMyPhoneDocument = gql` mutation validateMyPhone($test: String!) { validateMyPhone(test: $test) } `; export type ValidateMyPhoneMutationFn = Apollo.MutationFunction<ValidateMyPhoneMutation, ValidateMyPhoneMutationVariables>;
-
There are two options;
No response
import type { CodegenConfig } from '@graphql-codegen/cli'; const config: CodegenConfig = { overwrite: true, schema: [ SCHEMAURL1, SCHEMAURL2 ], documents: 'src/graphql/**/*.{ts,tsx}', generates: { 'src/generated/gql/': { preset: 'client', plugins: ['typescript-react-apollo'], config: { documentMode: 'graphQLTag', withHooks: true, }, presetConfig: { gqlTagName: 'gql', }, }, './graphql.schema.json': { plugins: ['introspection'], }, }, }; export default config;
I just hit this error today, any solutions?
Which packages are impacted by your issue?
@graphql-codegen/typescript-graphql-apollo
Describe the bug
I want to generate apollo hooks on new version of codegen but when I use
client
preset withtypescript-react-apollo
, they got conflict and creates same variables two times. If I don't useclient
preset, then it asksinput - output
on all queries.example result;
Your Example Website or App
-
Steps to Reproduce the Bug or Issue
client
preset andtypescript-react-apollo
Expected behavior
There are two options;
client
preset andtypescript-react-apollo
work together and merge exportsclient
preset supports hooksScreenshots or Videos
No response
Platform
Codegen Config File
Additional context
No response