Releases: facebook/flow
v0.271.0
Notable bug fixes:
- Multiple levels of
export *will now be correctly indexed so that they won't be missing in autoimport results.
Library Definitions
- Add
Float16Arraytype
v0.270.0
Likely to cause new Flow errors:
- When component syntax support is enabled, upper case functions with component-like name but doesn't return
React.Nodewill no longer be treated like components. Thus, all the hooks call in such functions will havereact-rule-hook-definitely-not-in-component-or-hookerrors. - Usage of
Object.assignwill now triggerunsafe-object-assignlint error that's on by default. The type checking behavior forObject.assignwill otherwise stay the same for now. - When Flow decides that the hook call definitely doesn't happen within component or hook body, it will emit errors with code
react-rule-hook-definitely-not-in-component-or-hook.
Parser:
- Parse the TS nonnull assertion operator.
v0.269.1
It should have the same behavior as 0.269.0.
v0.268.0
Breaking:
- The Linux x86 build is now built from
ubuntu-22.04. It might make Flow not runnable on older linux distributions.
Likely to cause new Flow errors:
- Code like the (example) will have
[react-rule-hook-conditional]instead of[react-rule-hook-naming-convention]errors. $Diffsupport is removed. If you have trouble migrating, you can try to polyfill it by this. However,$Diffhas surprising behavior with regard to optional props in the second type parameter, which cannot be easily polyfilled (example).
New Features:
- We now allow you to configure certain error code to be unsuppressable. For example, to make
react-rule-hook-naming-conventionandreact-rule-hook-conditionalerrors unsuppressable, you can add the following to the[options]section in flowconfig:
unsuppressable_error_codes=react-rule-hook-naming-convention
unsuppressable_error_codes=react-rule-hook-conditional
v0.267.0
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)
v0.266.1
- Fix a bug that causes fixed
libdef-overrideerror to stick around after an incremental recheck.
v0.266.0
Likely to cause new Flow errors:
- Support for
$PropertyTypeand$ElementTypehas been removed. Now referencing these types will just resolve to a global type if you have your own definition for them, and result in acannot-resolve-nameerror otherwise. These types have been replaced by index access types for a long time. You can migrate to index access types by enabling use-indexed-access-type from https://www.npmjs.com/package/eslint-plugin-fb-flow and running the quickfixes. If you are unable to migrate, you can add the following to your global libdefs:
type $PropertyType<T, K> = T[K];
type $ElementType<T, K> = T[K];
- Now given the subtyping check
component()<: component(ref?: ref_prop), Flow will ensure thatref_propis a subtype ofvoidinstead of a subtype ofReact.RefSetter<void>. React$ComponentType, which was previously given[internal-type]error on every usage, is now removed.React.ComponentType<Props>is now only an alias ofcomponent(...Props), instead of some special cased types. This comes with stricter checks and conversions, such as making Props readonly, erroring on the presence the ref prop instead of silently ignoring them, and ensures thatPropsis a subtype of{...}. In addition, theReact$AbstractComponenttype is removed.
Notable bug fixes:
- fixed a subtle unsoundness in the inference of computed-property dictionary object creation (e.g. try-Flow)
Library Definitions:
React.lazyandReact.memois now generic over the presence or absence of ref prop.
v0.265.3
- Make
@flowtypedresolution support work on Windows.
v0.265.2
Notable bug fixes:
- We fixed a bug that caused suppressions to not apply for
libdef-overrideerrors. - We fixed a bug that caused
libdef-overrideerrors not being raised even if it's turned on.
v0.265.1
Notable bug fixes:
- Make
libdef-override=offin[lints]section actually turn off alllibdef-overrideerrors.