apollographql / apollographql/apollo-tooling

Global Types generation doesn't generate all types

Open
#1,984 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

`apollo client:codegen` Global types generation seems to overwrite previous runs of global file generation even if it's in the same command.

**Intended outcome:**
A single global types file with all the types is generated

**Actual outcome:**
A single global types file is generated with only some of the types (from either only the .ts or only the .tsx files)

**How to reproduce the issue:**
- Create some queries and mutations across a selection of ts and tsx files. Make sure that there are complex/non-scalar types in the queries and mutations. Normally these types would be put in the globalTypes.ts
- Run `apollo client:codegen --includes=./**/*.{ts,tsx} --target=typescript --endpoint= --header=""`
- Note that not all the types are in the globalTypes.ts file. Only the types from one of the sets of ts or tsx files exists in this file.

**Versions**
2.28.0

Contributor guide

Open the contributing guide

Research direction

Start by running the reported apollo client:codegen command with queries and mutations in both .ts and .tsx files, then trace the globalTypes.ts generation path. Done means one global types file contains the non-scalar types from both file sets, with a regression test covering the combined include pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.