-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Summary: For fields with `catch(to: RESULT)` and fields nested within any `catch` we are handling all errors which might have caused a field to become null. This means we can respect semantic non-null in these positions. Pull Request resolved: #4794 Reviewed By: gordyf Differential Revision: D62645500 Pulled By: captbaritone fbshipit-source-id: b2e3e80fcfd2a692fd942ce856fc42dbc02f4e77
- Loading branch information
1 parent
79840ae
commit 26b78db
Showing
10 changed files
with
248 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...y-typegen/tests/generate_typescript/fixtures/linked-semantic-non-null-with-catch.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
==================================== INPUT ==================================== | ||
fragment MyFragment on Query { | ||
# Should be a Result of a non-nullable since it's semanticNonNull | ||
my_user @catch { | ||
name | ||
} | ||
} | ||
|
||
%extensions% | ||
|
||
extend type Query { | ||
my_user: User @semanticNonNull | ||
} | ||
==================================== OUTPUT =================================== | ||
import { FragmentRefs, Result } from "relay-runtime"; | ||
export type MyFragment$data = { | ||
readonly my_user: Result<{ | ||
readonly name: string | null | undefined; | ||
}, ReadonlyArray<unknown>>; | ||
readonly " $fragmentType": "MyFragment"; | ||
}; | ||
export type MyFragment$key = { | ||
readonly " $data"?: MyFragment$data; | ||
readonly " $fragmentSpreads": FragmentRefs<"MyFragment">; | ||
}; |
Oops, something went wrong.