github facebook/flow v0.239.0

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

Likely to cause new Flow errors:

  • We now detect errors when props of React components using component syntax, or hook argument/return values of React hooks using hook syntax, contain arrays, sets, or maps that are mutated using their methods (Array.push, Set.add, Map.set, etc). These values are expected to be read-only, and we previously errored on directly setting their props; this release extends this enforcement to method calls as well.
  • We are adding more strict checking for type guard functions to account for the refinement happening in the else branch of conditionals that use them (see docs for more information). You might see new errors appear in the declaration of type guards. One way to address these is by turning the type guard definition to one-sided, by adding implies before the type guard (example try-Flow)

New Features:

  • The StringPrefix type represents strings which being with the specified prefix. E.g. StringPrefix<'data-'> allows for 'data-floo' and 'data-bar'. The type argument for this type must be a string literal. [example]
  • Flow now supports globalThis.

Notable bug fixes:

  • Fixed an issue since 0.232.0 that will cause failure to connect to Flow server if libdef has parse errors.
  • Made the "extract to function" refactoring more robust to errors during code synthesis.
  • Fixed a bug that can cause hover to hang forever for recursive namespaces. example
  • Go-to-definition on new C() will jump to definition of C instead of the constructor definition. Hovering on C will still show the jsdoc on the constructor.
  • Strip as const casts and as casts in flow-remove-types

IDE:

  • Hover will show a list of all the symbols found in the inferred type and the locations where they are defined. VSCode LSP and CLI are supported. The LSP version includes a link to the definition. The CLI version only shows the name of the file (no path)

Library Definitions:

  • Calling shift() and pop() on an Array<T> will now return T | undefined.
  • Add cause property on Error instance; Support error cause in error constructor options
  • Add type definition for FinalizationRegistry
  • Add type definition for CSSSupportsRule
  • Add closeAllConnections, closeIdleConnections to https$Server

Don't miss a new flow release

NewReleases is sending notifications on new releases.