Releases: facebook/flow
Releases · facebook/flow
v0.295.0
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 ofSymbol.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
Parser:
- Support second argument of import expressions
Bug Fixes:
- Fixed bug in computing type hints under JSX expressions (Example of bug fixed)
v0.293.0
Config:
use_mixed_in_catch_variablesoption was renameduse_unknown_in_catch_variablesbecausemixedis being renamed tounknown
v0.292.0
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
IDE:
- Flow now provides a code action to fix all
invalid-type-cast-syntaxerrors in the file.
v0.290.0
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
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/StringSuffixto be included in object initializers with other non-overlapping keys (example try-Flow)
Library Definitions:
- Update React API types from recent releases
Added
act: 19.0: https://react.dev/reference/react/actcaptureOwnerStack: 19.1: See https://react.dev/reference/react/captureOwnerStackuseEffectEvent: 19.2: https://react.dev/reference/react/useEffectEvent<Activity />: 19.2: See https://react.dev/reference/react/Activity
UpdateduseDeferredValue: 19.0: Accepts a second argument for initial valueuseTransition: 19.0: Accepts an async action functionstartTransition: 19.0: Accepts an async action function
v0.288.0
Likely to cause new Flow errors:
React.ElementPropsis removed. You should useReact.ElementConfiginstead.- 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-syntaxerrors. 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 andReact$Contextare removed. It continues to be available in the form ofReact.RefSetter<...>andReact.Context<...>, regardless of whether you have importedReact.React$ElementRef<...>was removed. It continues to be available in the form ofReact.ElementRef<...>, regardless of whether you have importedReact.
Breaking Changes:
- The config option
max_literal_lengthwas 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
@@disposeand@@asyncDisposein your library typings. You can access the respective properties withobj[Symbol.dispose]andobj[Symbol.asyncDispose]. - Allow comparisons of bigint singletons
Library Definitions:
- The second type argument of
ExactReactElementwill be populated byReact.ElementConfig<C>instead ofReact.ElementProps<C>. Most of the code that doesn't depend on exact react element types won't be affected.
v0.287.0
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-parserpackage, which is running on wasm.
Likely to cause new Flow errors:
- The deprecated
React$Elementtype is now removed. You should useReact.NodeorReact.MixedElementin most cases. If you really want exact react elements, you can useExactReactElement_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
Breaking Changes:
- Starting from this version,
flow-binwill 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<...>andReact.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_supportis removed, and Flow now has better support for React 19's ref-as-prop behavior:- All the ref prop in component syntax components must be made optional
- 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)