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)
andif (x?.y === 42)
understand thatx
is truthy in the consequent. Flow also now refines subexpressions of optional chains. For example, givenobj?.fun(obj.value)
, the secondobj
is known to be truthy since it is only reachable if the earlierobj?.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 likenumber
is not aNumber
, and vice versa,symbol
is not aSymbol
. In the core lib defs, we change usage ofSymbol
tosymbol & Symbol
. Eventually, it will just besymbol
. Thesymbol & 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 printingempty
instead. This improves hover tooltips. - Fixed several issues causing various processes to die uncleanly while exiting.