-
Notifications
You must be signed in to change notification settings - Fork 1.8k
$RelayProps flow type is incorrect #2443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If the component prop type is I think the problem is that we're not generating the correct flow types in non-haste environments 👎 This is the problem: https://github.com/facebook/relay/blob/master/packages/relay-compiler/core/RelayFlowGenerator.js#L443 The difficulty is not knowing where to import the fragment from. |
for now you can enable haste environment on .flowconfig and this will work out fine https://flow.org/en/docs/config/options/#toc-module-system-node-haste |
what is the correct way to use |
$RelayProps is used internally for I opened #2516 to document the flow usage better, but pretty sure there are no fundamental issues with the types as we use them everywhere internally at Facebook. |
The flow type defined for
$RelayProps
is:A contrived usage might be like:
I think the intent is that
ModifiedProps
will come out like:That is, anything with a
$refType
property (anything thats a graphql fragment) should be converted from its full type given by the generated file into a$FragmentRef<T>
. However, it looks like the two{+$refType: empty}
lines in the$RelayProps
type might be defeating this, and simply returning the original type of each fragment prop. This is causing numerous missing property errors when usingcreateFragmentContainer
(#2394, #2316).Is there a reason for the
{+$refType: empty}
lines? Is the fix simply to remove them? Removing them in my own code seems work perfectly, and mycreateFragmentContainer
components are now typed correctly.The text was updated successfully, but these errors were encountered: