dotansimha / dotansimha/graphql-code-generator
Generated `TypedDocumentString` generic params improvement
- 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.
Currently, generated code including `TypedDocumentString` contains ugly and seemingly unnecessary type assertions. For example:
```ts
export const ProductsGetListDocument = new TypedDocumentString(`
query ProductsGetList {
products(first: 10) {
id
name
}
}
`) as unknown as TypedDocumentString;
```
### Describe the solution you'd like
The assertion can be omitted and generic parameters could be added directly after `new TypedDocumentString` like this:
```ts
export const ProductsGetListDocument = new TypedDocumentString(`
query ProductsGetList {
products(first: 10) {
id
name
}
}
`);
```
> **Note**
> I have a [very rough version of this implemented on my fork](https://github.com/dotansimha/graphql-code-generator/compare/master...typeofweb:graphql-code-generator:TypedDocumentString?expand=1). Could open a PR.
### Is your feature request related to a problem? Please describe.
It's not related to a problem _per se_ but generated code could be made prettier and more concise.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.