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
I disagree with it. In that example - asynchronous code, but even in async code, some situations can be correctly processed.
In the current example - simple synchronous code.
No one has the ability to change the data between if's predicate and console.log (If we are still talking about JS)
Flow doesn't treat console.log as a different function and considers that it can be unpure. Any function call will unvalidate refinements. There's a discussion somewhere to be able to declare functions as pure, but so far, nothing is settled.
For the following code,
Flow gives an error:
If I remove the second console.log, I get no errors. i.e, the following does not give any errors.
Why?
Since both the console.log statements are within the if condition, I don't think the error should come in the first case as well.
Or at least, the behavior should be consistent and same error given in the second case.
The code can be tried at https://flowtype.org/try/#0PQKgBAAgZgNg9gdzCYAoALgTwA4FMwAKuATgM5wB2YAvGAN4UCGAtrgFxinrECWFA5gBowuZox4wOXXgIC+Abgw58AIwCu-GvR4ATKdz5CwjUqR78KudmAD8RMpVmpUAN0bEwlhACENYDuqatHS6bADkgQCMYcImZhZWHBRqMDBOqDxQYAAUXr78AHRx5pa4AJT0qGBgAMaU5DC4BfD8ubg+GkWmJVYFTKxlitV1FA1NLW0dhcUJTaLiMIPVqOlAA
The text was updated successfully, but these errors were encountered: