dotansimha / dotansimha/graphql-code-generator
Supporting gql tag functions
- 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 `graphql-tag-operations` only emits typings when `graphql` function is used as a normal function. Any kind of mixing or interpolation throws it off. The way it's setup we cannot use GraphQL fragments and get the automagical typing
### Describe the solution you'd like
Since we have access to the sources, I suggest we create additional typings (could be hidden behind a flag) that when enabled, will emit [Template Literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) tag-function friendly types.
These could look like
```
export function gql(strings: ['\n query Query {\n', 'name }'], ...args: unknown)
```
The reference isn't perfect but you get the idea
### Describe alternatives you've considered
_No response_
### Is your feature request related to a problem? Please describe.
Yes. If you have a use case where you make use of fragments, you have to do a lot of hard-coding that could be automated with this feature
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.