Skip to content

Releases: facebook/flow

v0.290.0

06 Nov 00:50

Choose a tag to compare

Likely to cause new Flow errors:

  • flow will now validate variance in interface declarations
  • Bad cyclic object types are now banned. e.g. type O_loop = { p: 0, __proto__: O_loop } will cause an error.
  • Flow is now stricter with generic mapped type. example

Notable bug fixes:

  • We improved the refinement system of match. Some code that previously gets a general type will now get a refined type. example
  • allow opaque types to be used as keys to computed object properties
  • autocomplete on import { | } from 'a'; will only suggest values, not types.
  • flow-dev-tools now properly detects unused suppressions

IDE:

  • Flow now provide auto-import code actions for all unbound names, even through they might resolve to a global. It can be helpful when the global is not what you want.

Library Definitions:

  • Add bigint functions to DataView

v0.289.0

23 Oct 02:38

Choose a tag to compare

Likely to cause new Flow errors:

  • For a poorly bounded generic indexed access types, we will no longer generate an error for it when it's being first subtyped against. Instead, we will make it opaque so that when it's being subtyped against, it will error. example
  • Flow will error when you are trying to redefine the following reserved types: $NonMaybeType, NonNullable, $ReadOnly, Readonly, $Keys, $Values, Values, $ReadOnlyMap, ReadonlyMap, $ReadOnlySet, ReadonlySet.

Notable bug fixes:

  • We no longer incorrectly report conditional hook call for loops with a break. example
  • Fixed a potential crash when evaluating a conditional type. example
  • Flow will now allow computed keys of type StringPrefix/StringSuffix to be included in object initializers with other non-overlapping keys (example try-Flow)

Library Definitions:

  • Update React API types from recent releases
    Added

v0.288.0

13 Oct 07:39

Choose a tag to compare

Likely to cause new Flow errors:

  • React.ElementProps is removed. You should use React.ElementConfig instead.
  • For a function named as a hook but not annotated as a hook, it will no longer be treated like a hook when you try to use it from property access or property destructuring in component syntax components and hook syntax hooks. They will now cause react-rule-hook-non-hook-syntax errors. To fix, annotate them with hook annotation. example
  • Calling functions passed to function and component with hook like name but not annotated as hook will now error. example.
  • React$RefSetter<...> and and React$Context are removed. It continues to be available in the form of React.RefSetter<...> and React.Context<...>, regardless of whether you have imported React.
  • React$ElementRef<...> was removed. It continues to be available in the form of React.ElementRef<...>, regardless of whether you have imported React.

Breaking Changes:

  • The config option max_literal_length was removed. Flow will always decide whether to infer a specific or general type of string literal based on the natural inference algorithm.

Notable bug fixes:

  • You can now use @@dispose and @@asyncDispose in your library typings. You can access the respective properties with obj[Symbol.dispose] and obj[Symbol.asyncDispose].
  • Allow comparisons of bigint singletons

Library Definitions:

  • The second type argument of ExactReactElement will be populated by React.ElementConfig<C> instead of React.ElementProps<C>. Most of the code that doesn't depend on exact react element types won't be affected.

v0.287.0

27 Sep 16:02

Choose a tag to compare

Breaking Changes:

  • We will stop publishing new versions of flow-parser-bin. If you want to parse flow code with native-like performance, you should use hermes-parser package, which is running on wasm.

Likely to cause new Flow errors:

  • The deprecated React$Element type is now removed. You should use React.Node or React.MixedElement in most cases. If you really want exact react elements, you can use ExactReactElement_DEPRECATED

New Features:

  • Flow has full React 19 ref-as-prop support. Since this version, you are allowed to spread ref prop in component syntax components.

IDE:

  • We now provide a rewrite refactor to convert arrays, map, set, and object types into their readonly forms.

v0.286.0

24 Sep 18:58

Choose a tag to compare

Breaking Changes:

  • Starting from this version, flow-bin will only contain ARM64 binaries for macOS.

Likely to cause new Flow errors:

  • Flow now errors on constant conditions and invalid comparisons. example
  • Flow will no longer infer an unsound type for array and object literals passed to a general function. example
  • React.ElementConfig<...> and React.PropsOf<...> will now always include the ref prop in the props object type.
  • The config option for an earlier mode react.ref_as_prop=partial_support is removed, and Flow now has better support for React 19's ref-as-prop behavior:
    1. All the ref prop in component syntax components must be made optional
    2. You might need to rewrite some of your higher order components. e.g. previously an identity HOC must be written as
declare function id<Props: {...}, Ref>(c: component(ref?: Ref, ...Props)): component(ref?: Ref...Props)

now it must be written as

declare function id<Props: {...}>(c: component(...Props)): component(...Props)

v0.285.0

20 Sep 08:20

Choose a tag to compare

Library Definitions:

Bug fixes:

  • Fixed a bug that when experimental.ts_utility_syntax=true, imported Readonly, ReadonlyArray, NonNullable, ReadonlyMap, ReadonlySet types are considered any.

v0.284.0

18 Sep 20:02

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

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

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

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.