apollographql / apollographql/apollo-tooling

[feature request] [codegen/typescript] non-template literal tag syntax for graphql generate

Open
#2,530 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

see [this](https://www.graphql-code-generator.com/plugins/gql-tag-operations-preset) for an example of one example workaround

the problem with tagged templates is that the types of their arguments aren't narrowed to string literal types (even though this is always possible) - see [here](https://github.com/microsoft/TypeScript/issues/45504), so ideally using some alternate syntax (e.g. a regular function call) would be better.

granted, my usecase is *very* nonstandard, since i'm only using apollo to fetch schemas and generate types, so i use a standard web request library rather than apollo client to execute queries

Contributor guide

Open the contributing guide

Research direction

Start in the codegen/typescript entry point and compare the current tagged-template approach with the linked gql-tag-operations-preset workaround. Done means supporting an alternate non-template-literal syntax that preserves string-literal argument types for generated GraphQL operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.