dotansimha / dotansimha/graphql-code-generator

`typescript-operations` generate docs while using `preResolveTypes: true`

Open
#9,606 0 comments 4 reactions 0 assignees View on GitHub
core kind/bug stage/0-issue-prerequisites
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Is your feature request related to a problem? Please describe.

[preResolveTypes](https://the-guild.dev/graphql/codegen/plugins/typescript/typescript-operations#preresolvetypes) generates primitives instead of Pick/Omit for performance gains. However, doing so also loses the documentation/comments from schema. Having the documentation written in the server schema, and having it available in all types in frontend, can greatly improve DX.

Using `preResolveTypes: false` config option, will allow vscode to show the docs, while writing code:
![image](https://github.com/dotansimha/graphql-code-generator/assets/23189620/41b90060-d1a2-49c0-8091-cc1665f23f7e)

However, ussing `preResolveTypes: true` config option, will not transform the docs to the generated primitive types:
![image](https://github.com/dotansimha/graphql-code-generator/assets/23189620/d445685e-ccf7-4516-8e08-adf18634a8bc)

### Describe the solution you'd like

We would like to use the `preResolveTypes: true` config option, as it will speed up TS performance. But we would also like to see the docs be included in the types for better DX.

### Describe alternatives you've considered

Continue using `preResolveTypes: true` without docs added to types, but watch the docs from other place.

### Is your feature request related to a problem? Please describe.

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.