Skip to content

Releases: facebook/flow

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"]
}

v0.262.0

26 Feb 20:04
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Referencing React$Component directly will now be an error.
  • Use of React$ComponentType, React$Context and React$RefSetter will now trigger internal-type errors.

New Features:

  • Added types for JSX intrinsics, which will cause new errors and show autocomplete for DOM intrinsics like div

Notable bug fixes:

  • Replace incorrect definition for ClientRect and ClientRectList with aliases to DOMRect and DOMRectList
    This fixes the type definitions for the DOM APIs in Flow, but replacing an nonexistent globals ClientRect and ClientRectList types with just an alias to DOMRect and DOMRectList.
  • fixed a bug that caused spurious errors on rest array assignments (e.g. try-Flow).
  • When a library definition file has changed, Flow will no longer just stop the server. Instead, Flow will properly recheck everything, even under lazy mode.
  • We now allow something of type React.ComponentType<{}> to be a subtype of component()

IDE:

  • Component syntax components will now show up in document symbols

Library Definitions:

  • Most of the bundled libdefs will no longer be maintained and shipped with Flow. Going forward, they should be downloaded from flow-typed. 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"]
}

v0.261.2

18 Feb 23:09
Compare
Choose a tag to compare

Notable bug fixes:

  • Fixed a bug that causes incorrect updates to our index that tracks usage of exports, which leads to incorrect autoimport-ranked-by-usage results.

v0.261.1

13 Feb 22:06
Compare
Choose a tag to compare

Notable bug fixes:

  • Fixed a crash after initialization with saved state if the typing for react module is provided as a userland module.

v0.261.0

12 Feb 21:32
Compare
Choose a tag to compare

New Features:

  • Bigint values inside of template literals now coerce to strings, e.g. `${1n}`. Addition with string (e.g. 1n + 'blah') is still banned.
  • Add ability to resolve node package entrypoints/exports
  • Flow now allows inference of type guards for simple expression arrow functions with one parameter. For example, in ["a", null].filter(s => s != null) it will automatically infer that the arrow function encodes a x is string type guard and will apply it on the input array resulting in aArray<string>. (try-Flow)
  • module.system.node.root_relative_dirname will allow conditional mapping like module.system.node.root_relative_dirname='<PROJECT_ROOT>/foo' -> 'bar'. Under such config, import 'a' will only be resolved to <PROJECT_ROOT>/bar/a if import 'a' is in a file in the <PROJECT_ROOT>/foo directory. This feature will be helpful if you want to combine two flow roots with different module.system.node.root_relative_dirname config.

Likely to cause new Flow errors:

  • When an opaque type is refined to be not null/undefined, we now refine the opaque type's upper bound rather than returning the opaque type unmodified.

Notable bug fixes:

  • Flow will error more consistently on incompatible uses of refined string, number and boolean literal types (e.g. try-Flow)
  • Fixed some cases of type filtering during type guard refinement (e.g. try-Flow)
  • Fixed a bug of missing errors when certain functions were checked against interfaces (e.g. try-Flow)
  • Fixed negation of refinement of type-guard functions with multiple parameters (e.g. try-Flow)
  • Relaxed type-guard consistency checks when the function returns with true or false. (e.g. try-Flow)

Parser:

  • We now provide parsing support for declare global {...} (using it will still result in an error). The AST will have the shape of
{
    "type":"DeclareNamespace",
    "loc": ...,
    "range": ...,
    "global":true,
    "id":{
        "type":"Identifier",
        "loc": ...,
        "range":...,
        "name":"global",
        "typeAnnotation":null,
        "optional":false
    },
    "body":{
        "type":"BlockStatement",
        ...
    },
}

Library Definitions:

  • The global React$PureComponent is removed. If you want to refer to it, it needs to be imported from react.

v0.260.0

10 Feb 23:32
Compare
Choose a tag to compare

New Features:

  • You may now write object literals with Flow Enum values as computed keys. This will result in a dictionary type, keyed by the Flow Enum type. Note that all possible Flow Enum representation types are valid object keys, so we just support all of them.
  • You can use number typed keys (rather than just number literals) to create objects, these will be treated as dictionaries {[number]: T}

Notable bug fixes:

  • Fixed soundness hole in subtyping of type guard functions (e.g. try-Flow)
  • Fixed a bug that caused spurious errors when type guards were used in private methods (e.g. try-Flow)
  • Flow will no longer invalidate refinements made before the loop for const-like variables within a loop (example)

IDE:

  • For identifiers of array patterns bind to a require call, go-to-definition will jump to itself.

Library Definitions:

  • The internal type React$FragmentType is removed from Flow's builtin global type definitions.