apollo-tooling
apollo-tooling copied to clipboard
Error when generating typescript
I get the following error when generating types for typescript
TypeError: Cannot read property 'map' of undefined
at fields.map.rootField (/usr/local/lib/node_modules/apollo-codegen/src/typescript/codeGeneration.js:153:36)
at Array.map (<anonymous>)
at interfaceDeclarationForOperation (/usr/local/lib/node_modules/apollo-codegen/src/typescript/codeGeneration.js:152:19)
at Object.values.forEach.operation (/usr/local/lib/node_modules/apollo-codegen/src/typescript/codeGeneration.js:47:5)
at Array.forEach (<anonymous>)
at Object.generateSource (/usr/local/lib/node_modules/apollo-codegen/src/typescript/codeGeneration.js:45:37)
at Object.generate (/usr/local/lib/node_modules/apollo-codegen/src/generate.ts:42:16)
at Object.yargs.command.command.command.argv [as handler] (/usr/local/lib/node_modules/apollo-codegen/src/cli.js:183:7)
at Object.self.runCommand (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/lib/command.js:233:22)
at Object.Yargs.self._parseArgs (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/yargs.js:990:30)
when ran with the following command apollo-codegen generate src/**/*.graphql --schema src/graphql/schema.json --target ts --output src/graphql/schema.ts
It however runs without a problem if I change the target to flow
Version 0.16.5
Hi @JannesV ,
Maybe related to this issue #195 ?
Closing for now because this has likely been fixed as part of the rewrite in TypeScript. Feel free to ping for a re-open if you are still having this issue with the Apollo CLI!