Likely to cause new Flow errors:
- All
deprecated-type
anduntyped-type-import
lint are on and at error level by default. - Use of some internal types of Flow that have other identical public-facing variants (e.g.
React$ElementConfig
vsReact.ElementConfig
) are now a lint error that's enabled by default. To disable it, setinternal-type=off
in the lints section of the flowconfig. For now, these types are still allowed in libdef files, but we plan to also disallow it in the future. To codemod existing code, get the latestflow-upgrade
package and runyarn run flow-codemod replaceReactDollarUtilityTypes
- Direct use of
React$Element
type is banned via theinternal-type
lint. TheReact.Element
alias still exists for now, but it is marked with@deprecated
in the jsdoc. Please read the jsdoc for better alternatives. A global aliasExactReactElement_DEPRECATED
is added to help you clearly mark the use of exact React element types, and you should use it to replaceReact.Element
that you cannot replace without compromising runtime type safety. - Flow now consistently errors on bad comparison with enums example
New Features:
- Allow generic bound by inexact tuple as function rest args. This example now works.
- Support for
declare component
statement andcomponent
type is enabled by default. - Flow now provide the "insert inferred type as type cast" code action. You only need to select the expression in the editor to trigger the code action.
Notable bug fixes:
- Fixed a bug that causes an internal error. example
Misc:
experimental.namespaces
config option is removed. Namespaces support is enabled by default in the previous release.
Library Definitions:
- Add
.replaceChildren
method type definition for dom nodes. Object.getPrototypeof
is still special cased, but the special-casing is only available for a syntacticObject.getPrototypeof(...)
call. If you try to useObject.getPrototypeof
in some other ways (e.g.const f = Object.getPrototypeof; f(...)
), you will get a a less precise and accurate typing for it. TheObject$GetPrototypeOf
type, which was used to back the special case behavior, is removed.