v0.266.0
·
961 commits
to main
since this release
Likely to cause new Flow errors:
- Support for
$PropertyTypeand$ElementTypehas been removed. Now referencing these types will just resolve to a global type if you have your own definition for them, and result in acannot-resolve-nameerror otherwise. These types have been replaced by index access types for a long time. You can migrate to index access types by enabling use-indexed-access-type from https://www.npmjs.com/package/eslint-plugin-fb-flow and running the quickfixes. If you are unable to migrate, you can add the following to your global libdefs:
type $PropertyType<T, K> = T[K];
type $ElementType<T, K> = T[K];
- Now given the subtyping check
component()<: component(ref?: ref_prop), Flow will ensure thatref_propis a subtype ofvoidinstead of a subtype ofReact.RefSetter<void>. React$ComponentType, which was previously given[internal-type]error on every usage, is now removed.React.ComponentType<Props>is now only an alias ofcomponent(...Props), instead of some special cased types. This comes with stricter checks and conversions, such as making Props readonly, erroring on the presence the ref prop instead of silently ignoring them, and ensures thatPropsis a subtype of{...}. In addition, theReact$AbstractComponenttype is removed.
Notable bug fixes:
- fixed a subtle unsoundness in the inference of computed-property dictionary object creation (e.g. try-Flow)
Library Definitions:
React.lazyandReact.memois now generic over the presence or absence of ref prop.