github facebook/flow v0.247.0

6 hours ago

Breaking changes:

  • Support for the deprecated $Call type is removed. $Call will now resolve to whatever $Call points to in the global libdef. If you need more time to migrate, you can create a shim like $Call<F, T> = $TupleMap<[T], F>[0], but please note that we intend to remove support for $TupleMap eventually.
  • deprecated-type-dollar-call lint is removed, since the support for $Call is removed.
  • react.disable_function_components_default_props config option is removed. It is on by default since v0.238.

Likely to cause new Flow errors:

  • $TupleMap is deprecated and will be soon removed, now that mapped type works on array inputs. Existing $TupleMap will still work in this release, but every use will trigger a deprecated-type lint that is on by default.
  • Flow now performs literal subtyping checks for strict equality conditions in non-refinement contexts. example
  • Fixed destructuring with invalid literal defaults. The following now errors properly: example
  • Using string ref on components that are definitely not a class component is now an error. example
  • React utility types will no longer incorrectly accept hook types when they expect component types. e.g. type A = React$ElementConfig<hook (props: {foo: string}) => void>; will now error.

New Features:

  • Refinements against negated bigint literals should now work.

Notable bug fixes:

  • Mapped type on generic arrays is now supported. Previously it will fail with array is not an object error.
  • flow-remove-types now correctly handles as cast with generics.

IDE:

  • On hover, values that have React.AbstractComponent type will be shown in the component type syntax
  • Flow now offers a code action to insert inferred render type when you hover on the name of the component.
  • Flow now provides keyword completion for component type, hook types and render types.

Library Definitions:

  • Overly restrictive typing of queueMicrotask is now fixed.

Don't miss a new flow release

NewReleases is sending notifications on new releases.