graphql-code-generator icon indicating copy to clipboard operation
graphql-code-generator copied to clipboard

issues with generated file after react query v5 migration

Open idbd1 opened this issue 2 years ago • 0 comments

Which packages are impacted by your issue?

@graphql-codegen/cli

Describe the bug

I'm having several issues after migrating tanstack query to v5. Is there anything I might have missed in the codegen.ts? how can I fix the warnings in generated.ts.

how do I pass options to the query? the app doesn't want to start due to bad argument type

const currentUserQuery = useCurrentUserQuery({ enabled: !isLoggingIn });
TS2322: Type boolean is not assignable to type never

Your Example Website or App

can't share

Steps to Reproduce the Bug or Issue

  1. upgrade react query

Expected behavior

no warnings in generated.ts and no issues with useQuery or useMutation hooks

Screenshots or Videos

image

const currentUserQuery = useCurrentUserQuery({ enabled: !isLoggingIn }); TS2322: Type boolean is not assignable to type never

Platform

  • OS: macOS
  • NodeJS: 18.18.2
  • graphql version: 16.8.1
  • @graphql-codegen/* version(s): [e.g. 2.6.2]

"dependencies": { "@graphql-codegen/cli": "5.0.0", "@graphql-codegen/typescript-operations": "4.0.1", "@graphql-codegen/typescript-react-query": "6.0.0", "@graphql-eslint/eslint-plugin": "3.20.1", "@graphql-typed-document-node/core": "3.2.0", "@tanstack/eslint-plugin-query": "4.34.1", "@tanstack/react-query": "5.17.19",


### Codegen Config File

// @ts-ignore import type { CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = { overwrite: true, schema: '../schema.graphql', reactQueryVersion: 5, documents: 'src/**/*.graphql', generates: { 'src/generated/generated.ts': { plugins: ['typescript', 'typescript-operations', 'typescript-react-query'], config: { fetcher: '../fetcher#fetcher', namingConvention: { enumValues: 'keep', }, }, }, }, };

export default config;


### Additional context

_No response_

idbd1 avatar Jan 23 '24 07:01 idbd1