github facebook/flow v0.243.0

latest releases: v0.252.0, v0.251.1, v0.251.0...
3 months ago

Likely to cause new Flow errors:

  • All deprecated-type and untyped-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 vs React.ElementConfig) are now a lint error that's enabled by default. To disable it, set internal-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 latest flow-upgrade package and run yarn run flow-codemod replaceReactDollarUtilityTypes
  • Direct use of React$Element type is banned via the internal-type lint. The React.Element alias still exists for now, but it is marked with @deprecated in the jsdoc. Please read the jsdoc for better alternatives. A global alias ExactReactElement_DEPRECATED is added to help you clearly mark the use of exact React element types, and you should use it to replace React.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 and component 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 syntactic Object.getPrototypeof(...) call. If you try to use Object.getPrototypeof in some other ways (e.g. const f = Object.getPrototypeof; f(...)), you will get a a less precise and accurate typing for it. The Object$GetPrototypeOf type, which was used to back the special case behavior, is removed.

Don't miss a new flow release

NewReleases is sending notifications on new releases.