Skip to content

Releases: facebook/flow

v0.284.0

18 Sep 20:02
Compare
Choose a tag to compare

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

17 Sep 04:49
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Invalid suppressions like // $FlowFixMe[incompatible will now cause an error on the suppression

v0.282.0

16 Sep 20:52
Compare
Choose a tag to compare

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

04 Sep 19:25
Compare
Choose a tag to compare

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 was new.

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 like require-explicit-enum-switch-cases but for match.

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

27 Aug 15:10
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Accessing missing exports on namespaced import will now trigger missing-export error instead of prop-missing error. (example)
  • The only supported suppress_type $FlowFixMe is now just a type alias of any. 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 supported supress_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 into incompatible-type. The change was announced in the previous version, with option to enable it via experimental.error_code_migration=new. Now the only valid option to experimental.error_code_migration is new. You can run flow 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

14 Aug 23:28
Compare
Choose a tag to compare

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 add experimental.error_code_migration=new in your flowconfig to enable the new behavior now. We also provide a codemod flow 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:

v0.278.0

01 Aug 02:03
Compare
Choose a tag to compare

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 of react-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

24 Jul 19:30
Compare
Choose a tag to compare

Notable bug fixes:

  • Fixed windows builds.

v0.277.0

23 Jul 13:03
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Array literals that cannot be contextually typed can no longer be passed to mutable tuples with a more general element type. It might cause additional errors. example

v0.276.0

18 Jul 23:06
Compare
Choose a tag to compare

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 with function generics and component generics!