Releases: facebook/flow
Releases · facebook/flow
v0.284.0
Likely to cause new Flow errors:
- Flow now strictly enforces that Array.includes, .indexOf, and .lastIndexOf take only values that could potentially be present in the array -- it is now an error to check if arrays include values whose types are unrelated to the array's element type. This catches many cases where developers accidentally test the wrong thing, which may lead to errors at runtime.
- Flow will infer general types for react jsx elements. The new behavior is described in the docs.
v0.283.0
Likely to cause new Flow errors:
- Invalid suppressions like
// $FlowFixMe[incompatible
will now cause an error on the suppression
v0.282.0
Likely to cause new Flow errors:
- Multiple object property invariant subtyping errors on the same object will be combined into one error. Some error locations might be moved.
Notable bug fixes:
- Fixes crash happening on exported functions with signatures of the form
<X>(x: X, y: typeof x): T
IDE:
- We now provide a best effort quickfix for some invariant subtyping errors.
Library Definitions:
Array.find
can now return a more precise value if the predicate is inferred to be a type guard. example
v0.281.0
Breaking Changes:
- Support for the
casting_syntax=colon
is removed. This means that the as casting syntax is always enabled. experimental.error_code_migration
config option is removed. In the previously version, the only allowed value wasnew
.
Likely to cause new Flow errors:
- We have fixed more source of object literal unsoundness. More errors will be exposed. (example)
- For most of the common invariant subtyping errors (arrays, objects with mutable fields), we will now emit a single subtyping error with explanation how to fix. Error locations might change. See https://flow.org/en/docs/lang/variance/#toc-invariance to learn more about variance of types
- Suppressions without error code will now be an error instead of a warning.
- Suppressions without error code will no longer apply. You can download and use this script to automatically migrate most of the suppressions.
- Only
$FlowFixMe
and$FlowExpectedError
are supported suppression comments. Existing$FlowIgnore
and$FlowIssue
will no longer suppress anything.
New Features:
- Added a Flow lint
require-explicit-enum-checks
which works likerequire-explicit-enum-switch-cases
but formatch
.
Notable bug fixes:
- Various codemods will now insert parentheses around expressions in class extends if they are changed. Previously, it might result in invalid code like
class Foo extends myExpr() as Bar
- Fixes an inconsistency in recording the this-type guard on a regular (non-
declare
) method in the same vs different files.
IDE:
- Added a quickfix to convert type to value imports on type-as-value errors.
v0.280.0
Likely to cause new Flow errors:
- Accessing missing exports on namespaced import will now trigger
missing-export
error instead ofprop-missing
error. (example) - The only supported
suppress_type
$FlowFixMe
is now just a type alias ofany
. For most of the code, there will be no functional differences. However, you might see new errors if you have any local definitions of$FlowFixMe
, or you used the undocumented$FlowFixMe<arbitrary type arguments>
. - Support for
suppress_type
config has been removed. The only supportedsupress_type
now is$FlowFixMe
. If you want other variants, you can add
type MySuppressType = any
in your global library definitions.
- Many subtyping type errors' error codes have been standardized into
incompatible-type
, so some previously suppressed errors will reappear until you change the suppression error code intoincompatible-type
. The change was announced in the previous version, with option to enable it viaexperimental.error_code_migration=new
. Now the only valid option toexperimental.error_code_migration
isnew
. You can runflow codemod error-code-migration --write .
with the previous version of Flow to help migrate, since the codemod is removed in this version.
v0.279.0
New Features:
- In the next release (0.280.0) of Flow, we intend to standardize the error code for various subtyping errors into
incompatible-type
. You can addexperimental.error_code_migration=new
in your flowconfig to enable the new behavior now. We also provide a codemodflow codemod error-code-migration --write .
that you can run over your codebase to automatically change the error code. Both the flowconfig option and the codemod will be removed in the next version.
Notable bug fixes:
- Improved precision of error messages when inferred primitive types are checked against other incompatible primitive types (e.g. try-Flow)
Misc:
- Thanks @JamBalaya56562 for fixing various typos across the codebase!
v0.278.0
Likely to cause new Flow errors:
- Hooks calls inside normal functions in component or hooks as conditional calls. They will get
react-rule-hook-conditional
error instead ofreact-rule-hook
error. - Array literals that cannot be contextually typed will be inferred as an actual array type. It might cause additional errors. example
v0.277.1
Notable bug fixes:
- Fixed windows builds.
v0.277.0
v0.276.0
Likely to cause new Flow errors:
- Hook calls inside anonynous functions bound to a variable will get
react-rule-hook-definitely-not-in-component-or-hook
error, if the variable name doesn't conform to hook naming convention. example
IDE:
- Added support for workspace symbol feature
Misc:
- Thanks @jbroma for improving
as
casts withfunction
generics andcomponent
generics!