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
Strange "unconstrained" behavior with React components #9007
Comments
This is expected behavior. The difference is caused by whether the generic react component has some typing context coming from the parent. If there is a usable typing context, then even if some type argument cannot be solved from arguments and return hints, we will happily use default of the type parameter or bound (mixed if not specified) of the type parameter as the solution. |
So the react element tree changes typing context?
|
The new example seems like a bug. I will reopen and investigate. |
Thanks. Sorry, it took me a second to realize the issue could be boiled down more simply |
|
Summary: The cache was properly rolled back before, but it was dropped by mistake in D41361086 (f05653c). Close #9007 Changelog: [errors] Some additional errors might be revealed after a correctness fix in implicit instantiation. Example: https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVBLAtgBzgJwBcwAlAUwEMBjYqfOLMAcn0pqYG5UoBXAOxoY4fMAGEGePmT6EAPABUAXGD48 (114c051e26016bfbd117d80634e48c55442fdf2f)sAIzL4AfAAocOejgDOygN4VF8gL4BKZeWqEAJADk4AEzJgz19MGAwKAoMGFRZDwwAN21ZcVxhaWIKAF4zQnweMmswYFjgSJiuIA Reviewed By: panagosg7 Differential Revision: D43207712 fbshipit-source-id: 86b80d0a42a01d654e2e1c42d9a65b0f176fe9b0
I'm seeing what I believe to be unexpected pass-cases and, in general, inconsistent behavior with underconstrained component props. I've boiled down the example to something simple enough to illustrate the problem but still gets to the brunt of my real-world use-case.
The general premise is being able to have:
type
andstate
fields)type
field as well as take in a component that should expect the correspondingstate
In general, I've gotten Flow to handle this well (albeit inconsistently) until I start nesting the component in something else (even just a
<div/>
)Example:
Looking at the TryFlow link below, Flow handles this situation well except in the last cases, which I'm not sure why. This feels like a bug, but maybe I'm missing something.
Try Flow
The text was updated successfully, but these errors were encountered: