Likely to cause new Flow errors:
- Flow might catch more inexact incompatible with exact errors. example
- Fixed a bug that leads to Flow sometimes ignoring differences in call props of an object. New errors might be exposed. example
- We rewrite the way we generate types for annotations. We will now detect and error on trivially recursive types like
type T = T
ortype Foo = typeof foo; const foo: Foo = ...
. In addition to this, you might see some errors being moved around. - Fixed Flow Enums exhaustive checking logic when input is a generic.
- Invalid indexed access types with string index, like {foo: string}[string], will now error instead of silently making it
any
.
New Features:
- You can have a tuple spread of a generic in the parameter of a function and not have to supply the relevant type argument if that spread is the only spread in that tuple, and it is the last element of that tuple.
- Negative numbers are now allowed in Flow Enum values.
- Allow Flow Enums to be cast to their representation type when the cast expression is typed as a generic type.
- Added a new global type
EnumValue<>
, which represents all Flow Enum values. You can constrain the enum values to those with a particular representation type by supplying the type argument, e.g.EnumValue<string>
. - Added a new global type
Enum<>
, which represents all Flow Enums (this is a complement to the newEnumValue
type). You can constrain the enums to ones which have a particular enum value, e.g.Enum<>
is the same asEnum<EnumValue<>>
, and the type of all enums with string representation types isEnum<EnumValue<string>>
. These "abstract enums" have no know members, so you can't access members or exhaustively check them, but you can use methods such as.members()
,.cast()
, etc. - Allow
===
comparison of abstract Flow Enums as well as Enums themselves with the same ID. - You can now cast Flow Enum values to their representation type using
.valueOf()
, e.g.enum E {A, B}; const s: string = E.A.valueOf()
.
Notable bug fixes:
- We now error more reliably in the matching property tests, for example when the object part is a complex expression. example
- Fixed spurious errors in propagating type hints. example
- Infer type in a conditional type is now allowed to be underconstrained. When the true branch is taken, this underconstrained infer type will be pinned to the upper bound. example
- Add
Enum
andEnumValue
to$NotNullOrVoid
- previously there was no supertype for all enum values or enums.
IDE:
- We now show jsdoc information on component props with component syntax.