dotansimha / graphql-code-generator

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
https://the-guild.dev/graphql/codegen/
MIT License
10.86k stars 1.33k forks source link

data in react example is not typed #9020

Closed tombohub closed 1 year ago

tombohub commented 1 year ago

Which packages are impacted by your issue?

No response

Describe the bug

'you say in documentation that data is typed but it's not image

Your Example Website or App

https://github.com/dotansimha/graphql-code-generator/tree/master/examples/react/urql

Steps to Reproduce the Bug or Issue

download example install packages yarn check the code

Expected behavior

data to be typed with proper type, not any

Screenshots or Videos

No response

Platform

Codegen Config File

/* eslint-disable import/no-extraneous-dependencies */
import { type CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = {
  schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
  documents: ['src/**/*.tsx', '!src/gql/**/*'],
  generates: {
    './src/gql/': {
      preset: 'client',
    },
  },
  hooks: { afterAllFileWrite: ['prettier --write'] },
};

export default config;

Additional context

No response

beerose commented 1 year ago

Works fine on a freshly cloned repo after installing dependencies.

CleanShot 2023-03-14 at 18 25 22@2x

You can try restarting your TS server in VSCode.

CleanShot 2023-03-14 at 18 24 41@2x