You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The un-annotated component should not need any type annotations.
Actual behavior
Flow requires me to annotate a component if I'm gonna use it inside an exported component, but this happens only if the un-annotated component is rendered as root of the exported component.
If I wrap the un-annotated component with something else (a fragment, a div, etc), then Flow doesn't require me to annotate it.
I know Flow wants us to annotate the exported functions, components, etc... but I'm not exporting that component, I'm using it inside a component that's getting exported.
This is because Flow infers the return type of Ko to be something like React$Element<typeof ContainerB>, which causes the type of ContainerB to end up in the externally-visible interface. This means that all input positions must be annotated. If you don't want that type to end up in the externally-visible interface, you can use a more generic return type annotation for Ko, like React$Node. See this playground example
What's the need to use React$Element<typeof ContainerB> as return type? Shouldn't be enough to return one of the types that compose React$Node (for example, if my component returns an array?
Flow version: 0.110.1
Expected behavior
The un-annotated component should not need any type annotations.
Actual behavior
Flow requires me to annotate a component if I'm gonna use it inside an exported component, but this happens only if the un-annotated component is rendered as root of the exported component.
If I wrap the un-annotated component with something else (a fragment, a div, etc), then Flow doesn't require me to annotate it.
I know Flow wants us to annotate the exported functions, components, etc... but I'm not exporting that component, I'm using it inside a component that's getting exported.
Why is it behaving this way?
The text was updated successfully, but these errors were encountered: