Skip to content

Releases: facebook/flow

v0.273.1

11 Jun 19:22
Compare
Choose a tag to compare

Notable bug fixes:

  • Fixed windows builds.
  • Fixed crash when loading saved state.

v0.273.0

06 Jun 20:00
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • We are announcing Natural Inference for Flow, an improved way to infer types for primitive values, that resolves a long-standing correctness gap and source of confusion. See more in this post.
  • Added nested-hook and nested-component lint errors which detect nested hook or component syntax within component or hook syntax. This is on by default.

Notable bug fixes:

  • For default imports, the autoimport ranking will now consider the names of the importing side. (e.g. Previously we completely ignored the name of foo in import foo from './bar', but now we will count foo. If the pattern of import foo from './bar' happens a lot, then the autoimport algorithm will be more likely to suggest import foo from './bar' rather than import bar from './bar').
  • Flow will infer a correct type when viewing the type of an object literal as a dictionary type. For example, the error in this try-Flow will be raised.
  • Previously, we undercounted some imports during indexing, which causes autoimport ranking to behave incorrectly. The issue is now fixed.
  • Flow will no longer emit react-rule-hook-conditional error for hooks called in a conditionally defined nested component.

v0.272.2

30 May 22:10
Compare
Choose a tag to compare

Notable bug fixes:

  • Prevent non-termination when computing code actions.

v0.272.1

24 May 15:18
Compare
Choose a tag to compare

Notable bug fixes:

  • Fixed https://flow.org/try. It was broken from v0.270.0 to v0.272.0.
  • Documentation in hover now preserves indentations. Therefore, code blocks in jsdoc will no longer lose indentation.

v0.272.0

22 May 00:40
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • When component syntax is enabled, hook calls happen inside an upper case function that doesn't have a props param that's a subtype of interface {} will get react-rule-hook-definitely-not-in-component-or-hook error.
  • Calling a function that's a union of hook and non-hook will now get react-rule-hook-mixed-with-non-hook error instead of react-rule-hook error. Calling functions named like hook but not in hook syntax will now get react-rule-hook-non-hook-syntax instead of react-rule-hook error.

Notable bug fixes:

  • Go-to-definition on default import of module.exports will correctly jump to the exporting file

Parser:

  • Fix crash on ''#!/usr/bin/env node\n'' when generating token list

Library Definitions:

  • React.forwardRef is marked as deprecated. We might remove it from our builtin libdef in the future.

v0.271.0

15 May 19:33
Compare
Choose a tag to compare

Notable bug fixes:

  • Multiple levels of export * will now be correctly indexed so that they won't be missing in autoimport results.

Library Definitions

  • Add Float16Array type

v0.270.0

12 May 18:43
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • When component syntax support is enabled, upper case functions with component-like name but doesn't return React.Node will no longer be treated like components. Thus, all the hooks call in such functions will have react-rule-hook-definitely-not-in-component-or-hook errors.
  • Usage of Object.assign will now trigger unsafe-object-assign lint error that's on by default. The type checking behavior for Object.assign will otherwise stay the same for now.
  • When Flow decides that the hook call definitely doesn't happen within component or hook body, it will emit errors with code react-rule-hook-definitely-not-in-component-or-hook.

Parser:

  • Parse the TS nonnull assertion operator.

v0.269.1

28 Apr 22:56
Compare
Choose a tag to compare

It should have the same behavior as 0.269.0.

v0.268.0

16 Apr 15:11
Compare
Choose a tag to compare

Breaking:

  • The Linux x86 build is now built from ubuntu-22.04. It might make Flow not runnable on older linux distributions.

Likely to cause new Flow errors:

  • Code like the (example) will have [react-rule-hook-conditional] instead of [react-rule-hook-naming-convention] errors.
  • $Diff support is removed. If you have trouble migrating, you can try to polyfill it by this. However, $Diff has surprising behavior with regard to optional props in the second type parameter, which cannot be easily polyfilled (example).

New Features:

  • We now allow you to configure certain error code to be unsuppressable. For example, to make react-rule-hook-naming-convention and react-rule-hook-conditional errors unsuppressable, you can add the following to the [options] section in flowconfig:
unsuppressable_error_codes=react-rule-hook-naming-convention
unsuppressable_error_codes=react-rule-hook-conditional

v0.267.0

11 Apr 17:38
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • We have updated the way type parameters are instantiated in generic calls, specifically when using upper bounds:

    • We will no longer infer synthetic intersection types.
    • If multiple upper bounds are available, we pick the smallest type based on subtyping (example).
  • Support for $Rest is removed. Omit should be used instead. If you still have many instances of $Rest, you can replace them with $Diff as a temporary measure, but note that we intend to eventually remove $Diff as well.

  • React-rule hook errors related to conditional hook calls will now have react-rule-hook-conditional error code.

  • React-rule hook errors related to naming convention issues will now have react-rule-hook-naming-convention error code.

Notable bug fixes:

  • We are rolling out the initial phase of a fix to a fundamental soundness issue related to primitive literal type inference. This unsoundness has allowed invalid code like: const x = 'a'; 'b' as typeof x as 'a'; (try-Flow) to type check without errors. With this fix, Flow will infer singleton literal types for primitive literals in contexts where such precision is required. Examples of this are: const-declarations (e.g. in const x = 42 will infer the type 42 for x), annotation positions (e.g. typeof x is equivalent to the type 42), conditionals (e.g. in if (x.tag === 42) {} Flow will infer the type 42 for the value 42, instead of number). In this part of the rollout, whenever this precision is not required Flow will infer the unsound type it used to infer before (a hybrid between the singleton and general type). Eliminating this unsound type completely will be done soon.
  • flow-remove-types now handles the removal of empty imports after removing type/typeof imports (thanks @jbroma)