Likely to cause new Flow errors:
- All
deprecated-typeanduntyped-type-importlint 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$ElementConfigvsReact.ElementConfig) are now a lint error that's enabled by default. To disable it, setinternal-type=offin 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-upgradepackage and runyarn run flow-codemod replaceReactDollarUtilityTypes - Direct use of
React$Elementtype is banned via theinternal-typelint. TheReact.Elementalias still exists for now, but it is marked with@deprecatedin the jsdoc. Please read the jsdoc for better alternatives. A global aliasExactReactElement_DEPRECATEDis added to help you clearly mark the use of exact React element types, and you should use it to replaceReact.Elementthat 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 componentstatement andcomponenttype 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.namespacesconfig option is removed. Namespaces support is enabled by default in the previous release.
Library Definitions:
- Add
.replaceChildrenmethod type definition for dom nodes. Object.getPrototypeofis still special cased, but the special-casing is only available for a syntacticObject.getPrototypeof(...)call. If you try to useObject.getPrototypeofin some other ways (e.g.const f = Object.getPrototypeof; f(...)), you will get a a less precise and accurate typing for it. TheObject$GetPrototypeOftype, which was used to back the special case behavior, is removed.