Skip to content

Releases: facebook/flow

v0.193.0

11 Nov 22:56
Compare
Choose a tag to compare

New Features:

  • Add support for bigint. This includes the bigint type itself, subtyping with literals, libdefs, typeof, and sentinel refinement. For now, literal types are limited to 64 bit ints. Later changes may lift this restriction as well as implement support for operators.

Notable bug fixes:

  • Fix a few bugs related to the Haste package resolver. The Haste resolver falls back to the Node resolver when resolving packages. It now obeys the module.system.node.root_relative_dirname setting when doing so. Also, scoped package names are now supported in the Haste module resolver.
  • Allow private readonly properties to be written to in constructors, just like regular readonly properties.

Misc:

  • Update team members in CONTRIBUTING.md.
  • When using module.system=haste, importing packages in node_modules folders now obeys Node's resolution algorithm, rather than being able to be required from anywhere in the project.

Library Definitions:

  • Add a default generic value for getOwnPropertyDescriptor.

v0.192.0

04 Nov 05:01
Compare
Choose a tag to compare

Notable changes:

Likely to cause new Flow errors:

  • Unknown computed properties assignments are now completely banned. Previously, they were still allowed if the object is inexact.
  • cannot-resolve-name errors now are emitted for every use of an undefined variable, not just the first.

New Features:

  • Added an experimental flow lint for unused promises in async scope. You can enable it by adding unused-promise-in-async-scope in the lint section of your flowconfig.

Misc:

  • annotate-use-state and annotate-use-callback codemod commands have been merged into annotate-react-hooks4
  • Added an experimental "scm" saved state fetcher, which selects a saved state based on your currently source control revision.

Library Definitions:

  • Added support for Array.prototype.at
  • Fixed WeakSet type parameter bound to be interface {}

v0.191.0

27 Oct 12:53
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • The exact_empty_objects option is now enabled by default. Details about this change and how to update your codebase are covered on our blog.
  • The typeof X type annotation now respects the initialization state of X: if X hasn't been declared it will be an error to get its type.

Notable changes:

  • The enforce_local_inference_annotations config option was removed. To migrate your codebase, run the following codemod to add the required annotations: flow codemod annotate-lti. More details on the changes are explained in the Requiring More Annotations to Functions and Classes in Flow blog post.
  • Literals can be suggested by autocomplete in more cases
  • Fixed autocompleting specifiers in an import statement

v0.190.1

21 Oct 20:52
Compare
Choose a tag to compare
  • Fix a bug on Windows where the server would exit unexpectedly after hg update
  • Performance improvements

v0.190.0

14 Oct 03:29
Compare
Choose a tag to compare

Note:
Due to large number of likely new Flow errors that will be introduced in the next release, we decided to create an extra release to ease the upgrade process.
We announced in the recent blog post that we would remove the enforce_local_inference_annotations option in flowconfigs, as it became the default in v0.189.0. This change will be delayed to v0.191.0 instead.

Likely to cause new Flow errors:

  • Flow will now error on indexed write to exact objects without indexed type.
  • Flow now requires that the target of extends clauses in class definitions are either variables, casts, or member expressions, rather than allowing arbitrary expressions.
  • We fixed a bug in which type arguments were not passed to the type parameters of static callable methods.
  • We unblocked constraints involving any and type applications like Promise<T>, which may cause new downstream errors to be discovered.

Notable bug fixes:

  • Fix a bug that can cause the Flow server to unnecessarily restart when Watchman restarts

v0.189.0

12 Oct 19:14
Compare
Choose a tag to compare

Likely to cause new Flow errors:

New Features:

  • Class members can be suggested by autocomplete even if this is not typed explicitly.

Notable bug fixes:

  • We will now consistently emit object-this-reference errors. Previously these errors were missing when the object is an argument of Object.freeze(), Object.defineProperties() or Object.create().
  • Fix crash when walking directories that can't be accessed.
  • Fixed a potential crash when two type identifiers are declared in the same block.

Library Definitions:

  • Improve fs.readFile type definition when the encoding config option is supplied.

v0.188.2

06 Oct 06:39
Compare
Choose a tag to compare

Bug fixes:

  • Fix crash during incremental recheck

Performance:

  • Improve performance of auto-imports index update for large codebases

v0.188.1

30 Sep 00:48
Compare
Choose a tag to compare

Bug fixes:

  • Fix a crash when querying hg

Misc:

  • We renamed the codemod command flow codemod annotate-lti to flow codemod annotate-functions-and-classes to clarify that this is not the only codemod necessary for enabling LTI eventually.

v0.188.0

29 Sep 03:12
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Previously we supported a weird JS runtime rule for constructor returns when you call new SomeClass:

    • If the returned value is primitive, then it's ignored and the instance will be returned instead.
    • If the returned value is object like, then the return object will be the eval result of new SomeClass.

    This is confusing, and we dropped support for this feature in this release. Now we enforce that all class constructors must return void.

  • Fixed a bug preventing refinements from being invalidated in inline && expressions: examples like typeof x === 'number' && reassignXToString() && (x: number) were passing even if reassignXToString() assigned a a string value to x.

New Features:

  • flow codemod annotate-lti is now provided to help prepare your codebase to enable the enforce_local_inference_annotations=true flag. In order to eventually enable local type inference, we will require additional annotations in places we can't contextually type your code. You can enable the annotation enforcement now with enforce_local_inference_annotations=true in flowconfig. This flag enables the behaviors of all the following experimental flags, which will be deleted in the next release:
experimental.enforce_local_inference_annotations=true
experimental.enforce_this_annotations=true
experimental.enforce_class_annotations=true

To migrate your codebase, you can run the following codemod to prepare your codebase for the new requirement: flow codemod annotate-lti. Check out an upcoming blog post for more details.

Misc:

  • Remove the file_watcher.watchman.survive_restarts flowconfig option, which was deprecated in 0.158.0. We will always try to survive Watchman restarts.
  • Remove the experimental.refactor flowconfig option. It has been true by default since v0.158.0.

Library Definitions:

  • Updates the typing of fs.promises.readdir() to reflect the possibility of passing withFileTypes: true and receiving an array of Dirent objects

v0.187.1

20 Sep 01:26
Compare
Choose a tag to compare
  • Fix a crash introduced in 0.187.0 when the file walker fails to open a directory