Skip to content

Releases: facebook/flow

v0.295.0

18 Dec 23:54

Choose a tag to compare

New Features:

  • Support 4 well-known symbols (Symbol.iterator, Symbol.asyncIterator, Symbol.dispose, Symbol.asyncDispose) in class methods. For now, the computed method name needs to be exactly in the form of Symbol.iterator (or other 3 names) to be recognized.

Notable bug fixes:

  • Flow will now error when a function parameter appears in the default expression for the same binding. (e.g. try-Flow)

Misc:

  • Introduced a codemod for migrating legacy utility types to modern equivalents (yarn run flow-codemod convertLegacyUtilityTypes)

Parser:

  • Flow now parses import attributes. For now, we don't do any semantic validation yet

v0.294.0

10 Dec 21:02

Choose a tag to compare

Parser:

  • Support second argument of import expressions

Bug Fixes:

v0.293.0

05 Dec 10:54

Choose a tag to compare

Config:

  • use_mixed_in_catch_variables option was renamed use_unknown_in_catch_variables because mixed is being renamed to unknown

v0.292.0

02 Dec 20:51

Choose a tag to compare

Likely to cause new Flow errors:

  • Flow will start to validate variance for declare classes.

Parser:

  • Rename ClassDeclaration property 'superTypeParameters' to 'superTypeArguments'

v0.291.0

10 Nov 21:42

Choose a tag to compare

IDE:

  • Flow now provides a code action to fix all invalid-type-cast-syntax errors in the file.

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)