facebook / facebook/relay

Feature request: the Relay compiler should accept tagged literals of the form graphql(backtick ... backtick), not just graphql backtick ... backtick

Open
#4,884 15 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

* If Relay accepted template literals of the form
```
graphql(`...`)
```
then one could ingest the persisted queries json file and generate a file like [this one](https://github.com/isographlabs/isograph/blob/a28a4a47b846695b98f14d58cdde0c82e7c317a6/demos/pet-demo/src/components/__isograph/iso.ts), and give each graphql invocation the correct type (i.e. the type of the default export of the generated file) in TypeScript.

This requires changes to the babel plugin along the lines of [this](https://github.com/isographlabs/isograph/blob/main/libs/isograph-babel-plugin/compileTag.js#L20)

If y'all are down for this, I can make a PR real quick.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.