Skip to content

Releases: facebook/flow

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)

v0.266.1

29 Mar 20:39
Compare
Choose a tag to compare
  • Fix a bug that causes fixed libdef-override error to stick around after an incremental recheck.

v0.266.0

27 Mar 15:50
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Support for $PropertyType and $ElementType has been removed. Now referencing these types will just resolve to a global type if you have your own definition for them, and result in a cannot-resolve-name error otherwise. These types have been replaced by index access types for a long time. You can migrate to index access types by enabling use-indexed-access-type from https://www.npmjs.com/package/eslint-plugin-fb-flow and running the quickfixes. If you are unable to migrate, you can add the following to your global libdefs:
type $PropertyType<T, K> = T[K];
type $ElementType<T, K> = T[K];
  • Now given the subtyping check component()<: component(ref?: ref_prop), Flow will ensure that ref_prop is a subtype of void instead of a subtype of React.RefSetter<void>.
  • React$ComponentType, which was previously given [internal-type] error on every usage, is now removed.
  • React.ComponentType<Props> is now only an alias of component(...Props), instead of some special cased types. This comes with stricter checks and conversions, such as making Props readonly, erroring on the presence the ref prop instead of silently ignoring them, and ensures that Props is a subtype of {...}. In addition, the React$AbstractComponent type is removed.

Notable bug fixes:

  • fixed a subtle unsoundness in the inference of computed-property dictionary object creation (e.g. try-Flow)

Library Definitions:

  • React.lazy and React.memo is now generic over the presence or absence of ref prop.

v0.265.3

17 Mar 22:35
Compare
Choose a tag to compare
  • Make @flowtyped resolution support work on Windows.

v0.265.2

14 Mar 20:27
Compare
Choose a tag to compare

Notable bug fixes:

  • We fixed a bug that caused suppressions to not apply for libdef-override errors.
  • We fixed a bug that caused libdef-override errors not being raised even if it's turned on.

v0.265.1

14 Mar 16:52
Compare
Choose a tag to compare

Notable bug fixes:

  • Make libdef-override=off in [lints] section actually turn off all libdef-override errors.

v0.265.0

13 Mar 19:30
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Overriding already defined names and modules in library definitions will now error with code [libdef-override]. The error cannot be suppressed without specific error code like $FlowFixMe[libdef-override]. It can be turned off by turning off the libdef-override lint.

New Features:

  • The Number static methods Number.isFinite, Number.isInteger, Number.isNaN, and Number.isSafeInteger now apply a refinement that their input is a number. Note that the top level isNaN and isFinite functions (not off of Number) do not apply the same refinement as they first coerce their input to number.

Notable bug fixes:

  • Fix a potential crash in libdef files with illegal import export. Thanks @techieshark for the repro.

v0.264.0

13 Mar 01:32
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Signature verification errors will now show up for libdef files

New Features:

  • Declaration merging for declare namespace is now supported in toplevel library definitions.

Notable bug fixes:

  • In component type annotation, the ref prop can now have any type.

Library Definitions:

  • Since the last version, most of the bundled libdefs will no longer be maintained and shipped with Flow. Going forward, they should be downloaded from flow-typed. Starting from this version, we will also no longer ship a set of precise typing definition for jsx intrinsics. To maintain the same behavior as before, you should have a flow-typed.config.json in the root of your project with the following content:
{
  "env": ["node", "dom", "bom", "intl", "cssom", "indexeddb", "serviceworkers", "webassembly", "jsx"]
}

v0.263.0

04 Mar 15:09
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Signature verification errors will now show up for libdef files

New Features:

  • Declaration merging for declare namespace is now supported in toplevel library definitions.

Notable bug fixes:

  • In component type annotation, the ref prop can now have any type.

Library Definitions:

  • Since the last version, most of the bundled libdefs will no longer be maintained and shipped with Flow. Going forward, they should be downloaded from flow-typed. Starting from this version, we will also no longer ship a set of precise typing definition for jsx intrinsics. To maintain the same behavior as before, you should have a flow-typed.config.json in the root of your project with the following content:
{
  "env": ["node", "dom", "bom", "intl", "cssom", "indexeddb", "serviceworkers", "webassembly", "jsx"]
}