github facebook/flow v0.267.0

latest releases: v0.294.0, v0.293.0, v0.292.0...
8 months ago

Likely to cause new Flow errors:

  • We have updated the way type parameters are instantiated in generic calls, specifically when using upper bounds:

    • We will no longer infer synthetic intersection types.
    • If multiple upper bounds are available, we pick the smallest type based on subtyping (example).
  • Support for $Rest is removed. Omit should be used instead. If you still have many instances of $Rest, you can replace them with $Diff as a temporary measure, but note that we intend to eventually remove $Diff as well.

  • React-rule hook errors related to conditional hook calls will now have react-rule-hook-conditional error code.

  • React-rule hook errors related to naming convention issues will now have react-rule-hook-naming-convention error code.

Notable bug fixes:

  • We are rolling out the initial phase of a fix to a fundamental soundness issue related to primitive literal type inference. This unsoundness has allowed invalid code like: const x = 'a'; 'b' as typeof x as 'a'; (try-Flow) to type check without errors. With this fix, Flow will infer singleton literal types for primitive literals in contexts where such precision is required. Examples of this are: const-declarations (e.g. in const x = 42 will infer the type 42 for x), annotation positions (e.g. typeof x is equivalent to the type 42), conditionals (e.g. in if (x.tag === 42) {} Flow will infer the type 42 for the value 42, instead of number). In this part of the rollout, whenever this precision is not required Flow will infer the unsound type it used to infer before (a hybrid between the singleton and general type). Eliminating this unsound type completely will be done soon.
  • flow-remove-types now handles the removal of empty imports after removing type/typeof imports (thanks @jbroma)

Don't miss a new flow release

NewReleases is sending notifications on new releases.