Unable to find any GraphQL type definitions for the following pointers: src/**/*.graphql

The file your shared is your schema (as generated by your server), but it seems that you haven’t created any queries or mutations on top of it. This would be a reason why the codegen is not working properly.

I suggest thay you create a new file with a simple query, such as: get-users.query.graphql

query GetUsers {
  user {
    _id
    __typename
    name
    surname
    email
    phone
  }
}

And add it to your src folder (since your codegen is configured to find all .graphql files inside your src folder). Then re-run the codegen and see if it works well.

Aftewards you can generated all kinds of .graphql files with your queries and mutations and use the codegen to generate the corresponding types.

Leave a Comment

tech