facebook / facebook/relay

Incorrect TS typing on result

Open
#4,210 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

This query (note `owner { handle` part and IDE showing `!`):

CleanShot 2023-02-03 at 12 05 00@2x

Leads to this incorrectly type generated (note `readonly owner?: {`!):

CleanShot 2023-02-03 at 12 05 43@2x

Additional details:

Used here:

CleanShot 2023-02-03 at 12 06 23@2x

Leading to type error in code that is impossible:

CleanShot 2023-02-03 at 12 05 58@2x

And here is our GraphQL Schema (note line 1640):

![](https://user-images.githubusercontent.com/19226286/216666581-8354a447-fe79-4ac6-b1d3-2ef0404f3719.png)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the query and comparing its generated TypeScript result type with the GraphQL schema shown at line 1640. Trace the generation path that makes owner optional, then add or update the relevant regression coverage so the generated type matches the schema and the impossible type error is gone.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.