question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I generate automatic typescript types, with Hasura and graphql-codegen [Question]

See original GitHub issue

I was following Hasura automatic type generation for React/Angular Apps. It seems that code-gen takes all the query and mutation and introspection and then it generates typescript type defs.

https://hasura.io/learn/graphql/typescript-react-apollo/codegen/

In refine since I don’t have to write query and mutation, how can I generate typescript type definition file. As of now I am writing all possible query and mutation.

I am using create react app and refine as npm deps

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
nirmaanlabscommented, Apr 15, 2022

@omeraplak yes definitely. Let me first try how to generate all possible queries and mutation Thanks

1reaction
omeraplakcommented, Apr 15, 2022

Hey @nirmaanlabs, Unlike GraphQL clients, Refine does not use introspection. Our approach is to generate a query. We think this approach is much more manageable, but not being able to auto-generate TypeScript types is a big miss…

Data providers are responsible for creating the queries. for example, https://github.com/pankod/refine/blob/master/packages/graphql/src/index.ts#L63

Read more comments on GitHub >

github_iconTop Results From Across the Web

Your Guide to GraphQL with TypeScript - Hasura
Tutorial · Step One: Clone and configure the code repository · Step Two: Run Hasura Console · Step Three: Generate the typings ·...
Read more >
GraphQL code generator with Typescript, Angular ... - YouTube
In previous videos we build a small Angular App which uses Hasura GraphQL engine as a backend. And everything is great and works...
Read more >
Support for generating types from Hasura · Issue #344 - GitHub
I used to do this automatically with https://graphql-code-generator.com/. It can even generate ready to use React hooks for you (Apollo or Urql) ...
Read more >
Generate GraphQL Types with Apollo Codegen Tutorial
Generate TypeScript types for queries written in an Apollo Client project (given a valid GraphQL schema). And that's exactly what we'll do.
Read more >
typescript - GraphQL Code Generator
This plugin generates the base TypeScript types, based on your GraphQL schema. The types generated by this plugin are simple, and refers to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found