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
$Restis removed.Omitshould be used instead. If you still have many instances of$Rest, you can replace them with$Diffas a temporary measure, but note that we intend to eventually remove$Diffas well. -
React-rule hook errors related to conditional hook calls will now have
react-rule-hook-conditionalerror code. -
React-rule hook errors related to naming convention issues will now have
react-rule-hook-naming-conventionerror 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. inconst x = 42will infer the type42forx), annotation positions (e.g.typeof xis equivalent to the type42), conditionals (e.g. inif (x.tag === 42) {}Flow will infer the type42for the value42, instead ofnumber). 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-typesnow handles the removal of empty imports after removing type/typeof imports (thanks @jbroma)