apollographql / apollographql/apollo-tooling
Typescript generation error "Cannot read property 'getType' of undefined"
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
Getting a confusing error when generating typescript files, as it is a bit in the bowels I'm not sure if I'm messing something up or if I'm using bad options. I can provide the schema if interested.
apollo codegen:generate --addTypename --target typescript graphql
√ Loading Apollo config
√ Scanning for GraphQL queries (458 found)
× Generating query files with 'typescript' target
→ Cannot read property 'getType' of undefined
TypeError: Cannot read property 'getType' of undefined
at Object.NamedType (C:/Users//AppData/Roaming/npm/node_modules/apollo/node_modules/graphql/validation/rules/KnownTypeNames.js:64:25)
Contributor guide
Research direction
Start by reproducing the reported `apollo codegen:generate --addTypename --target typescript graphql` command with the relevant schema and queries. Inspect the TypeScript generation path and the reported `KnownTypeNames.js` failure at line 64, then confirm that generation completes without the `getType` error for the supplied case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100