Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

GraphQL Apollo types generation on React Native

$
0
0

I'm using

  • Neo4J 4.2
  • Apollo server
  • GraphQL & @neo4j/graphql (to generate Neo4J types from schema.graphql)
  • Expo React Native + Apollo Client
  • TypeScript

And I wanted to generate TS types for GraphQL queries by following this tutorial.

By default apollo-cli will look in ./src folder, but in React Native I don't have such a folder, it's all in root. So when I tried to change includes config for apollo client like so:

<root>/apollo.config.jsmodule.exports = {  client: {    includes: ['**/*.{ts,tsx}'],  },};

Running

> apollo codegen:generate --endpoint=http://localhost:4001/ --target=typescript --tagName=gql

Resulted in:

Error: Error initializing Apollo GraphQL project "Unnamed Project": Error: Error in "Loading queries for Unnamed Project": Error: ️️There are multiple definitions for the `OpName` operation. Please rename or remove all operations with the duplicated name before continuing.

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>