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.

Not generating types for queries

See original GitHub issue

Hi, I’m trying to generate types for my queries using this command (tried some other variations as well), But its only generating types based on my schema and not the queries I make in my react components (output here) I expect to also see some types matching the allPeople query inside allPeople.graphql. What am I doing wrong? Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
rdemetrescucommented, Feb 15, 2018

This “It seems like you provided a GraphQL schema instead of GraphQL document” warning happened to me too, when I upgraded graphql package version from 0.12.3 to 0.13.0

1reaction
dotansimhacommented, Jun 13, 2018

@JohannesHoppe try to wrap your glob selector with “…”, your command should be something like that:

gql-gen --schema https://api.angular.schule/graphql --template graphql-codegen-typescript-template --out ./src/app/graphql-types.ts "./src/**/*.ts"

(and your probably need to escape it if you are putting it inside package.json). It happens because your file system resolves the * before glob gets it, and it does not support features like ** (for recursive lookup)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generate GraphQL Types with Apollo Codegen Tutorial
In this post, you'll learn how to use Apollo's GraphQL codegen to generate TypeScript types for GraphQL operations in your Apollo Client ...
Read more >
Why apollo client:codegen is not generate types?
You need to include the --includes option to indicate which files contain the actual queries for which to generate the types. From the...
Read more >
How to Generate Typescript Types for GraphQL in React Project
In this article, I am going to tell you what is graphql-codegen, and how to use graphql-codegen to generate typescript types and react...
Read more >
Advanced type safety (Reference) - Prisma
Prisma Client provides full type safety for queries, even for partial queries or included relations. This page explains how to leverage the generated...
Read more >
How to use GraphQL Code Generator with React and Apollo
Ideally, this type-safe chain should not stop at the GraphQL API. ... Run npm run codegen to generate types and hooks for queries, ......
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