github facebook/flow v0.198.0

latest releases: v0.247.1, v0.247.0, v0.246.0...
20 months ago

Likely to cause new Flow errors:

  • Implicit coercion of booleans to numbers is consistently disallowed. Previously, booleans could be implicitly coerced to numbers in addition expressions. Prefer explicitly converting booleans to numbers.
  • Binary arithmetic errors are now reported on the expression rather than the operands, and use error code unsafe-arithmetic.
  • keyof, undefined, never, unknown, and readonly are now reserved types. If you have a user-defined types of these names, rename them to something else.

New Features:

  • TypeScript syntax helpers. To help people familiar with TypeScript syntax ramp up on similar Flow syntax:
    • Parse and error on keyof type operator, recommending $Keys<...> instead.
    • Parse and error on undefined type, recommending void instead.
    • Parse and error on never type, recommending empty instead.
    • Parse and error on unknown type, recommending mixed instead.
    • Parse and error on readonly applied to tuple and array type syntax.
    • Parse and error on usage of in/out/in out variance annotations.
    • Parse and error on as, as const, and satisfies cast expressions.
  • Add a codemod to fix underconstrained-implicit-instantiation errors only detectable under LTI. You can run flow codemod annotate-implicit-instantiations --include-lti --ignore-suppressed --write .

Notable bug fixes:

  • Fix a bug in LTI mode where some errors were hidden in implicit instantiation calls (e.g. Try Flow)
  • Fix unsound behavior of sentinel refinement with unions of numeric types as tags (e.g. Try Flow)
  • No annotation is required in LTI for callback parameters when the callee is a refined object member (e.g. Try Flow)

IDE:

  • When typing in an object literal, entire method signatures from the object type will be suggested.
  • Method signature autocomplete items are now visually distinguished from other kinds of autocomplete items.
  • Fix manually triggering autocomplete on the last empty line of a file giving no results.
  • Members from Object.prototype are no longer included in autocomplete results.

Parser:

  • Fix parsing of for await (async of ...) (regressed in 0.197.0)
  • Fix parsing of for (let in x) in non-strict mode
  • Fix parsing of class fields named static
  • Fix missing parse errors on keywords containing escape sequences (regressed in 0.180.0)
  • Fix missing parse error when using await as a parameter in an async arrow function
  • Fix missing parse error for export { ReservedWord as ... }
  • Fix incorrect parse error on export * as ReservedWord from ..., which is now allowed
  • Treat && and || as tokens when parsing types to improve error messages
  • Parse the argument of the typeof type argument as a value, not a type, as it is a value

Library Definitions:

  • Add Element.getAttributeNames(): Array<string>

Don't miss a new flow release

NewReleases is sending notifications on new releases.