Skip to content

Releases: facebook/flow

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!

v0.275.0

04 Jul 15:02
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • For all object literals in positions that cannot be contextually typed, we will infer a stricter type for them. It will cause new errors in code like
const foo = {baz: new Dog()};
type Foo = {bar?: string, baz: Animal};
declare function acceptFoo(foo: Foo): void;
acceptFoo(foo); // error

To fix the error, you can either annotate the object

const foo: Foo = {baz: new Dog()};

type Foo = {bar?: string, baz: Animal};
declare function acceptFoo(foo: Foo): void;

acceptFoo(foo);

or make the call site accepts readonly objects:

const foo = {baz: new Dog()};

type Foo = $ReadOnly<{bar?: string, baz: Animal}>;
declare function acceptFoo(foo: Foo): void;

acceptFoo(foo);

We provide a codemod to automate the annotation process. flow codemod annotate-literal-declaration --write --max-type-size 5. (You can adjust the max type size based on your needs).

IDE:

  • Support rename on private properties and methods.

Library Definitions:

  • React$MixedElement is removed from builtin libdef. It will cause internal-type error since v0.258.0. You should use React.MixedElement instead.

v0.274.2

27 Jun 18:48
Compare
Choose a tag to compare
  • Bug fixes for match

v0.274.1

26 Jun 01:07
Compare
Choose a tag to compare

New Features:

  • Support for experimental match feature using option experimental.pattern_matching=true

v0.274.0

24 Jun 15:43
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Unannotated object literals reachable from exports will now be inferred to have all mutable fields when being imported. Previously, it has unsound types, so new errors might appear.
  • When comparing two object types whose properties have variance incompatibilities, Flow will raise a single error that will summarize the properties with incompatible variances, instead of a single error for each property. (e.g. try-Flow)
  • When an object with extra properties is passed to a place that expect an exact object, we will now generate a single error with all extra properties. The error message will list the extra properties, and state that "Exact objects do not accept extra props". In rare cases, the error locations might be moved.
  • Flow will error more consistently with sketchy-bool on nullable boolean types (e.g. try-Flow)

Library Definitions:

  • All properties in the builtin PropertyDescriptor type are marked as readonly. If you need a mutable version, you can introduce something like type MutablePropertyDescriptor<T> = {...$Exact<PropertyDescriptor<T>>, ...}