Releases: facebook/flow
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. $Diff
support is removed. If you have trouble migrating, you can try to polyfill it by this. However,$Diff
has 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-convention
andreact-rule-hook-conditional
errors 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
$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. inconst x = 42
will infer the type42
forx
), annotation positions (e.g.typeof x
is equivalent to the type42
), conditionals (e.g. inif (x.tag === 42) {}
Flow will infer the type42
for 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-types
now handles the removal of empty imports after removing type/typeof imports (thanks @jbroma)
v0.266.1
- Fix a bug that causes fixed
libdef-override
error to stick around after an incremental recheck.
v0.266.0
Likely to cause new Flow errors:
- Support for
$PropertyType
and$ElementType
has 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-name
error 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_prop
is a subtype ofvoid
instead 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 thatProps
is a subtype of{...}
. In addition, theReact$AbstractComponent
type 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.lazy
andReact.memo
is now generic over the presence or absence of ref prop.
v0.265.3
- Make
@flowtyped
resolution support work on Windows.
v0.265.2
Notable bug fixes:
- We fixed a bug that caused suppressions to not apply for
libdef-override
errors. - We fixed a bug that caused
libdef-override
errors not being raised even if it's turned on.
v0.265.1
Notable bug fixes:
- Make
libdef-override=off
in[lints]
section actually turn off alllibdef-override
errors.
v0.265.0
Likely to cause new Flow errors:
- Overriding already defined names and modules in library definitions will now error with code
[libdef-override]
. The error cannot be suppressed without specific error code like$FlowFixMe[libdef-override]
. It can be turned off by turning off thelibdef-override
lint.
New Features:
- The
Number
static methodsNumber.isFinite
,Number.isInteger
,Number.isNaN
, andNumber.isSafeInteger
now apply a refinement that their input is anumber
. Note that the top levelisNaN
andisFinite
functions (not off ofNumber
) do not apply the same refinement as they first coerce their input to number.
Notable bug fixes:
- Fix a potential crash in libdef files with illegal import export. Thanks @techieshark for the repro.
v0.264.0
Likely to cause new Flow errors:
- Signature verification errors will now show up for libdef files
New Features:
- Declaration merging for
declare namespace
is now supported in toplevel library definitions.
Notable bug fixes:
- In component type annotation, the ref prop can now have any type.
Library Definitions:
- Since the last version, most of the bundled libdefs will no longer be maintained and shipped with Flow. Going forward, they should be downloaded from flow-typed. Starting from this version, we will also no longer ship a set of precise typing definition for jsx intrinsics. To maintain the same behavior as before, you should have a
flow-typed.config.json
in the root of your project with the following content:
{
"env": ["node", "dom", "bom", "intl", "cssom", "indexeddb", "serviceworkers", "webassembly", "jsx"]
}
v0.263.0
Likely to cause new Flow errors:
- Signature verification errors will now show up for libdef files
New Features:
- Declaration merging for
declare namespace
is now supported in toplevel library definitions.
Notable bug fixes:
- In component type annotation, the ref prop can now have any type.
Library Definitions:
- Since the last version, most of the bundled libdefs will no longer be maintained and shipped with Flow. Going forward, they should be downloaded from flow-typed. Starting from this version, we will also no longer ship a set of precise typing definition for jsx intrinsics. To maintain the same behavior as before, you should have a
flow-typed.config.json
in the root of your project with the following content:
{
"env": ["node", "dom", "bom", "intl", "cssom", "indexeddb", "serviceworkers", "webassembly", "jsx"]
}