Releases: facebook/flow
Releases · facebook/flow
v0.254.2
v0.254.1
Notable bug fixes:
- Fixed a potential crash when experimental multiplatform support is enabled.
v0.254.0
Likely to cause new Flow errors:
- Previously we incorrectly applied truthy refinement on optional chaining where it shouldn't be applied. The issue is now fixed, and you might see change in behavior similar to these examples
Library Definitions:
- Improve Array
toSpliced
method type (thanks @aph!)
v0.253.0
Likely to cause new Flow errors:
React$ElementRef
is now implemented with a conditional type instead of a builtin Flow utility type. You might see new errors with genericReact$ElementRef
. Most of the times, you should replaceReact.ElementRef<T>
with justT
if there are no other uses of genericT
.- We've increased safety in checks involving recursive types.
New Features:
- You can now set multiple
@flowtyped
like directories viamodule.declaration_dirnames
config. e.g.
module.declaration_dirnames=<PROJECT_ROOT>/decl1
module.declaration_dirnames=<PROJECT_ROOT>/decl2
Please note that when you set this, @flowtyped
at the root will no longer be considered special, and you will need to explicitly add it like
module.declaration_dirnames=<PROJECT_ROOT>/@flowtyped
Notable bug fixes:
- A generic type as input to conditional type will have type parameters pinned with their default or upper bound, instead of being
empty
. - We fixed a cache collision issue that might cause instantiation of a value-imported generic component type to interfere with a typeof-imported generic component type.
IDE:
- Flow now respects
includeDeclaration
from LSP request for find-references command. In practice, this means that "find all references" in vscode will continue to return both declaration and all uses, while "go to references" will exclude the declaration.
v0.252.0
Likely to cause new Flow errors:
- Flow will no longer apply type transformation to function components' props when you extract props through the utility types. For example, function components' props won't automatically get
$ReadOnly
applied, which might cause new errors.
New Features:
- We have removed the restriction of not allowing generics with ref prop in component syntax
Notable bug fixes:
- Files in
[declarations]
section will have all lint errors silenced. - Fixed an issue that caused errors in hover type on unions of evaluated types (example)
- Flow allows unions of strings to be used as the key in creation of objects with computed properties.
v0.251.1
Misc:
- Performance fix
v0.251.0
Likely to cause new Flow errors:
- Remove the deprecated
React.AbstractComponent
type. We recommend replacing them with component types. Since v0.249.0, we have provided a codemod via theflow-upgrade
package to aid larger codebases with this conversion:yarn run flow-codemod eliminateAbstractComponent path/to/src
. - In addition to the removal of
React.AbstractComponent
type, we also removed support for the internalReact$AbstractComponent
when more than 1 type argument has been passed. Similarly, you should migrate to use component types if you want to specify ref props and renders.
New Features:
- We now support a new way to easily specify library definitions for npm modules. For all files in
@flowtyped
directory at the root, they can be resolved by the relative path without leading./
relative to@flowtyped
. e.g.<PROJECT_ROOT>/@flowtyped/react.js.flow
can be used to type thereact
package, and<PROJECT_ROOT>/@flowtyped/react/jsx-runtime.js.flow
can be used to typereact/jsx-runtime
module. We now recommend using this approach instead of usingdeclare module
in global libdef.
Notable bug fixes:
any
will now correctly propagate to inferred render type. example.- Fixed a bug with regard to jsx type inference with generic callable objects. example
- Fixed a soundness hole that allowed frozen objects to be incompatible with non-readonly objects. This example will now produce an error.
Library Definitions:
- We have updated some core React type definitions to use the new component type instead of
React.AbstractComponent
. Most of the code won't be affected, but you might have to sometimes make the Props readonly.
v0.250.0
Likely to cause new Flow errors:
- Fix a bug where scope analysis of exported component type is done incorrectly, which causes generics mentioned within component type to be incorrectly typed as any.
Notable bug fixes:
- We will now remove previous props in generic component types in type argument inference. example
- When
all
option is specified in the config offlow-remove-types
, we now respect it and will correctly handle Flow-typed files without@flow
pragma.
v0.249.0
Likely to cause new Flow errors:
- Uses of
React$AbstractComponent
outside library definitions will now triggerinternal-type
lint error, which is on by default.React.AbstractComponent
is also marked as deprecated. We recommend replacing them with component types. We have provided a codemod via theflow-upgrade
package to aid larger codebases with this conversion:yarn run flow-codemod eliminateAbstractComponent path/to/src
.
Notable bug fixes:
- Fixed issue with
StringPrefix
andStringSuffix
when used as a component syntax prop. - Fixed an issue that causes type argument inference on component type to be incorrectly under-constrained. (example)
- Fixed
as
cast support inflow-remove-types
.
Library Definitions:
- React string refs are no longer supported in
React.cloneElement
. e.g.React.cloneElement(e, {ref: 'foo'})
will be an error. - The deprecated
React$Ref
type and various aliases of it are removed.
v0.248.1
IDE:
React.Component
annotated exported will now also show up in auto-imports in a type position.