Likely to cause new Flow errors:
- Remove the deprecated
React.AbstractComponenttype. We recommend replacing them with component types. Since v0.249.0, we have provided a codemod via theflow-upgradepackage to aid larger codebases with this conversion:yarn run flow-codemod eliminateAbstractComponent path/to/src. - In addition to the removal of
React.AbstractComponenttype, we also removed support for the internalReact$AbstractComponentwhen 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
@flowtypeddirectory at the root, they can be resolved by the relative path without leading./relative to@flowtyped. e.g.<PROJECT_ROOT>/@flowtyped/react.js.flowcan be used to type thereactpackage, and<PROJECT_ROOT>/@flowtyped/react/jsx-runtime.js.flowcan be used to typereact/jsx-runtimemodule. We now recommend using this approach instead of usingdeclare modulein global libdef.
Notable bug fixes:
anywill 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.