github facebook/flow v0.251.0

18 hours ago

Likely to cause new Flow errors:

  • Remove the deprecated React.AbstractComponent type. We recommend replacing them with component types. Since v0.249.0, we have provided a codemod via the flow-upgrade package to aid larger codebases with this conversion: yarn run flow-codemod eliminateAbstractComponent path/to/src.
  • In addition to the removal of React.AbstractComponent type, we also removed support for the internal React$AbstractComponent when more than 1 type argument has been passed. Similarly, you should migrate to use component types if you want to specify ref props and renders.

New Features:

  • We now support a new way to easily specify library definitions for npm modules. For all files in @flowtyped directory at the root, they can be resolved by the relative path without leading ./ relative to @flowtyped. e.g. <PROJECT_ROOT>/@flowtyped/react.js.flow can be used to type the react package, and <PROJECT_ROOT>/@flowtyped/react/jsx-runtime.js.flow can be used to type react/jsx-runtime module. We now recommend using this approach instead of using declare module in global libdef.

Notable bug fixes:

  • any will now correctly propagate to inferred render type. example.
  • Fixed a bug with regard to jsx type inference with generic callable objects. example
  • Fixed a soundness hole that allowed frozen objects to be incompatible with non-readonly objects. This example will now produce an error.

Library Definitions:

  • We have updated some core React type definitions to use the new component type instead of React.AbstractComponent. Most of the code won't be affected, but you might have to sometimes make the Props readonly.

Don't miss a new flow release

NewReleases is sending notifications on new releases.