github facebook/flow v0.114.0

latest releases: v0.237.1, v0.237.0, v0.236.0...
4 years ago

Likely to cause new Flow errors:

  • Fixed the order of evaluation of JSX attributes and children to match runtime, so that refinements work properly. This can lead to new errors if refined values are used as children, and a function is called within an attribute, because the refinements are now invalidated in a different order. On the other hand, calling a function in a child no longer incorrectly invalidates values used as attributes. [example]
  • Added support for refinements on optional chains! Now, examples like if (x?.y) and if (x?.y === 42) understand that x is truthy in the consequent. Flow also now refines subexpressions of optional chains. For example, given obj?.fun(obj.value), the second obj is known to be truthy since it is only reachable if the earlier obj?.fun is also truthy; therefore, you don't need to optional-chain it again (obj?.value).

New Features:

  • Added typechecking support for symbol! Note that just like number is not a Number, and vice versa, symbol is not a Symbol. In the core lib defs, we change usage of Symbol to symbol & Symbol. Eventually, it will just be symbol. The symbol & Symbol is temporary for one version to allow for existing usage of the : Symbol to be codemodded to : symbol.

Bug fixes:

  • Optimized typechecking pointwise-equal unions, from O(n^2) to O(n)
  • Optimized reverse dependency computation, greatly reducing the time spent computing what needs to be rechecked after an edit
  • Fixed an error message that pointed at the definition of a write-only property instead of the callsite that tried to read it [example]
  • Fixed an issue where coverage results could be incorrect in Types First mode when a file is rechecked
  • Fixed an issue when Flow prints evaluated types like $ElementType, that led to printing empty instead. This improves hover tooltips.
  • Fixed several issues causing various processes to die uncleanly while exiting.

Don't miss a new flow release

NewReleases is sending notifications on new releases.