facebook / facebook/relay

Do not type nullable fields with `undefined` within `@throwOnFieldError` and `@catch`

Open
#4,971 1 comment 1 reaction 0 assignees View on GitHub
shared with relay team
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

With `@throwOnFieldError` or `@catch` applied, missing data i.e. `undefined` should no longer be possible to be read from a fragment or operation (besides conditional selections from my understanding), so couldn't we stop generating `Type | null | undefined` in those cases for nullable fields and model them just as `Type | null` instead?

This would also apply to the raw response type. A field there should only be typed as `undefined` if it's conditional.

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.