apollographql / apollographql/apollo-tooling

Unused imports

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

Description

Hi!
I faced ts checking issue. Generated ts file have unused imports in my case.
In my frontend app i use component that can handle union of types (declared by fragment). And my GQL server have query that returns single one of this types.
I wondered my single type query with fragment on union type as result (like [this one](https://github.com/apollographql/apollo-tooling/pull/1872/commits/3d1eb164e460cc95fe5633a5f8c89e50ec198448#diff-432141440860f4fb4cc16a73e7850031R641-R643) ) is valid and working. But generated type file is not valid any more. Ts checker reports about unused imports from globalTypes. They are needed for other types in union, but generated file does not contain it.

Contributor guide

Open the contributing guide

Research direction

Start with the generated TypeScript file and its globalTypes imports, using the linked Apollo example to reproduce a fragment on a union returned by a single-type query. Run the TypeScript checker against that generated output; done means the generated file has no unused-import errors while retaining the types needed by the union.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.