github facebook/flow v0.232.0

latest releases: v0.252.0, v0.251.1, v0.251.0...
7 months ago

Likely to cause new Flow errors:

  • Support for $Compose and $ComposeReverse types are removed. We recommend to use overloads to approximate their behavior instead. e.g.
declare export function compose(): <T>(a: T) => T;
declare export function compose<F: (...$ReadOnlyArray<empty>) => mixed>(
  f: F,
): F;
declare export function compose<A, T: $ReadOnlyArray<any>, R>(
  f1: (a: A) => R,
  f2: (...T) => A,
): (...T) => R;
declare export function compose<A, B, T: $ReadOnlyArray<any>, R>(
  f1: (b: B) => R,
  f2: (a: A) => B,
  f3: (...T) => A,
): (...T) => R;
declare export function compose<A, B, C, T: $ReadOnlyArray<any>, R>(
  f1: (c: C) => R,
  f2: (b: B) => C,
  f3: (a: A) => B,
  f4: (...T) => A,
): (...T) => R;
declare export function compose<R>(
  f1: (b: any) => R,
  ...funcs: $ReadOnlyArray<(...$ReadOnlyArray<empty>) => mixed>
): (...$ReadOnlyArray<any>) => R;
declare export function compose<R>(
  ...funcs: $ReadOnlyArray<(...$ReadOnlyArray<empty>) => mixed>
): (...$ReadOnlyArray<any>) => R;
  • You might see more errors around type application. example
  • Fix subtyping of indexers in instances/interfaces. example

New Features:

  • Updated the isValid Flow Enums method to use a type guard, allowing it to refine its input to the enum type in a conditional context.
    E.g.
enum Status {Active, Off}
const s = "Active";
if (Status.isValid(s)) {
  s as Status; // Should work
}
  • export type Foo = ... and export interface Bar {...} statements are now allowed in declare module and declare namespace bodies.
  • We added a new codemod flow codemod remove-unnecessary-react-import which can help remove unnecessary react imports under react.runtime=automatic

Notable bug fixes:

  • Fixed issue when explicitly supplied JSX type arguments are ignored
  • Fixed code action output of casting syntax when LHS of as or as const has low precedence

Library Definitions:

  • Added definitions for the following APIs:
    • window.showOpenFilePicker(): MDN, WICG
    • window.showSaveFilePicker(): MDN, WICG
    • window.showDirectoryPicker(): MDN, WICG
    • DataTransferItem.getAsFileSystemHandle(): MDN, WICG
    • StorageManager.getDirectory(): MDN, WHATWG

Don't miss a new flow release

NewReleases is sending notifications on new releases.