Likely to cause new Flow errors:
- We fixed a bug that causes Flow to incorrectly believe that the LHS of logical operators are not nullable. example
- Flow can now detect more kinds of bad cyclic types. (example)
- Flow will now consistently catch some invalid comparison of the kind
obj.type === 'foo'
. example - Fixed a bug in the type guard refinement that involves sentinel properties (e.g. try-Flow)
Function.prototype.apply
andFunction.prototype.call
are now typed using userland types instead of hardcoded builtin support. You might see slight inference differences, error message and code changing as a result.- Flow now enforces that only function types are assigned to the
.constructor
property of object types. (D58538540 pvekris) - Fix subtyping checks of unions of bigint types against other unions of bigints.
- Make array holes be typed as
void
, notempty
.
New Features:
- You can now pass in an (optional) second type argument to the
StringPrefix
utility type. This is the type of the remainder of the string after the prefix is removed. For example,"$1"
,"$2"
are subtypes ofStringPrefix<'$', '1' | '2'>
, but"$999"
is not.StringPrefix<X>
is equivalent toStringPrefix<X, string>
- You can use the
$Values
utility type to get the type of the elements of an array type or tuple type. - You can now do sentinel refinements on tuples, like you can already do for objects. This is especially useful for function arguments (you can type the
...args
as a union of tuples). [example] - Sentinel refinements now work when using number keys on objects [example]
- Flow now keep original type after invalid object prop-exists refinement on write-only property.
Notable bug fixes:
- Some operations can now be performed on an opaque type with appropriate bounds. example
- Fixed a bug that occurs when you have a tuple type spread after two or more non-spread arguments. Those will now be resolved in the correct order.
Library Definitions:
String.codePointAt
now returnsnumber | void