Skip to content

Releases: facebook/flow

v0.219.0

18 Oct 00:02
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • We changed the upper bound of React.Element to be an inexact empty object, effectively making it opaque.
    React doesn't recommend inspecting children and React.Element, so we make the change to increase friction. See https://react.dev/reference/react/Children#alternatives for alternatives.
    To keep existing code type safe, you can add a function like the following to explicitly expose the internal of React.Element:
export default function DangerouslyAccessReactElementInternals_DO_NOT_USE_IN_NEW_CODE<
  E: React$ElementType,
  P,
>(e: React$Element<E, P>): {
  +key: React$Key | null,
  +props: P,
  +ref: any,
  +type: C,
} {
  return e;
}
  • Conditional types will now only distribute over a union if A in A extends B ? C : D is a generic type. This is a behavior change that might cause new errors (example). Previously, we distribute over unions in more cases, which contradicts what we said in the docs, and caused some weird behavior that's fixed in this version.
  • If an exported class contains unannotated propTypes, Flow will now emit signature-verification-failure.

New Features:

  • Hovering on enum members in IDE now show documentation if it's available.
  • Added casting_syntax option which can be colon (current), as, or both. If setting is both, both (x: T) and x as T are allowed. If set to colon or as, only (x: T) and x as T are allowed respectively.

Notable bug fixes:

  • Previously, when Flow cannot decide which branch to take in a generic conditional type, Flow will produce a abstract type that's unusable almost everywhere. Now Flow will still produce an abstract type, but it will be bounded above by a union type of both branches of conditional type. example.

Misc:

  • Flow's insert type quickfix in IDE will stop inserting very specific React.Element types. Instead, it will insert general types like React.MixedElement.

Library Definitions:

  • Add type definition for CanvasRenderingContext2D.roundRect.
  • Add tagName to DOM element declarations (thanks @aselbie).

v0.218.1

11 Oct 20:48
Compare
Choose a tag to compare

New Features:

  • Error collation during rechecks should become faster thanks to incremental computation. (Available with the flag --incremental-error-collation.)

v0.218.0

05 Oct 18:01
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • We start to validate variance inside $ReadOnly, which is previously completely unchecked. It also results in Flow complaining about some incorrect bounds. example

New Features:

  • Hover types will now show a specialized version of the callee expression at a call to a generic or intersection-typed function.

Notable bug fixes:

  • improve coverage accuracy for the element access portion on element calls, obj[m](arg).

Misc:

  • We slightly optimized Flow's performance of subtyping check between two union types.

Library Definitions:

  • Add defintions Array.prototype.findLastIndex(), String.prototype.at(), TypedArray.prototype.at() and Object.hasOwn() (thanks @pascalduez).
  • Update URL defintions (thanks @pascalduez).
  • Add typing for cause option in Error constructor.

v0.217.2

29 Sep 19:10
Compare
Choose a tag to compare

This is same as 0.217.1, but we have some issue publishing 0.217.1 to npm, so we will publish this new version instead.

v0.217.1

28 Sep 18:59
Compare
Choose a tag to compare

Notable bug fixes:

  • Previously, while global find ref/rename (experimental.global_find_ref=true/experimental.global_rename=true) is ongoing, all other IDE services will be blocked. We fixed it so that other IDE requests can still be served.

v0.217.0

21 Sep 18:20
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Flow will now ban variance annotations in function or function type parameters. example
  • React.Element is now opaque, but we still expose some of its internal structure via the bound on the opaque type. You should not depend on the internal structure. In a future release, we plan to make React.Element truly opaque.
  • Fixed an issue with implicit instantiation in operations over unions that caused many errors to be missed.
  • Changed the ref params on forwardRef and useImperativeHandle to be write-only. Patterns that rely on refining these params to an object and reading the ref field are misusing these APIs. example
  • React.ElementProps is now more precise when applied to AbstractComponents, resulting in the config type of the component rather than mixed. This will cause errors when elements of components with different props are passed into React.Element<> types.

Parser:

  • We now parse type arguments after typeof annotations. e.g. typeof MyGenericClass<string, number>. Type checking for this syntax is still not supported.

Library Definitions:

  • Update URLSearchParams definitions (thanks @pascalduez).
  • Update AbortSignal definitions (thanks @pascalduez).
  • Add Array copying methods (toReversed, toSorted, toSpliced and with) the $ReadOnlyArray class definitions (thanks @pascalduez).

v0.216.1

08 Sep 01:03
Compare
Choose a tag to compare

Notable bug fixes:

  • We fixed local find references for namespace imported variables. It will no longer error or return empty results.

v0.216.0

06 Sep 20:07
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • The ability to configure module.system.haste.use_name_reducers=false is removed. For now this option defaults to true and can only be set to true. The option to set the only possible value will be removed in a future release.

Notable bug fixes:

  • Fixed cases where hovering over a parser error could cause the Flow server to appear to hang.

Library Definitions:

v0.215.1

23 Aug 18:16
Compare
Choose a tag to compare

Notable bug fixes:

  • We fixed a bug that causes us to insert extra quote in autocomplete string literal in indexed access types.

v0.215.0

21 Aug 19:36
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Improved analysis determining if a function has an implicit void return. As a result, some incorrectly typed code will no longer type check. (example)
  • Fixed a bug where global assignments in generics wouldn't flag errors. (example)

New features:

  • Flow now supports contextual typing for class private property assignments. (example)

IDE:

  • Local find all references will now return a more comprehensive result list.
  • Go to definition now supports indexed access types.

Library Definitions: