github facebook/flow v0.224.0

latest releases: v0.246.0, v0.245.2, v0.245.1...
9 months ago

Likely to cause new Flow errors:

  • %checks is now deprecated. It will still work as before (for now), but if you enable the deprecated-type Flow lint, you will see additional errors. Instead, use type guards.
  • $Call, $ObjMap, $ObjMapi, $ObjMapConst are now deprecated. They will still work as before (for now), but if you enable the deprecated-type Flow lint, you will see additional errors. Since Flow 0.209, you can now use builtin types like Parameters, ReturnType, Pick, Omit to easily extract and transform types. For more advanced use cases, you can read the docs of conditional type and mapped type to understand how to write it in equivalent ways.
  • Ban creation of object literal computed properties with non-literal number keys
  • Ban accessing objects with non-literal number keys
  • You can now create and access object keys with int-like number literals, these act as their string equivalents.
  • Union of exact objects allow computed access as long as one of the members of the union have the property

New Features:

  • Add support for number literals as keys in object literals, e.g. const obj = {1: true, 2: false}
  • Support numeric keys in object type annotations. They are equivalent to the string version.

Notable bug fixes:

  • Removed spurious underconstrained error with mapped type, if the relevant type parameter already has a default. (example)
  • Support calling Array.from with string input and also mapping function, e.g. Array.from('str', x => x.length)

IDE:

  • [ide] Go-to-definition for a barrel-exported type name will now jump to the original definition location, instead of incorrectly jumping to itself.

Library Definitions:

  • Add type stubs for global crypto object, crypto.getRandomValues, and crypto.randomUUID
  • We removed StatelessFunctionalComponent type from the 'react' module and the React$StatelessFunctionalComponent type. The name might give an incorrect assumption that Flow can actually check that a function component doesn't use stateful hooks or can be called directly. If you have code that still uses this type, we recommend you use the React.AbstractComponent type, since it forces you to not make any assumption of what kind of React component you are dealing with.

Don't miss a new flow release

NewReleases is sending notifications on new releases.