Releases: facebook/flow
Releases · facebook/flow
v0.219.0
Likely to cause new Flow errors:
- We changed the upper bound of
React.Element
to be an inexact empty object, effectively making it opaque.
React doesn't recommend inspecting children and React.Element, so we make the change to increase friction. See https://react.dev/reference/react/Children#alternatives for alternatives.
To keep existing code type safe, you can add a function like the following to explicitly expose the internal ofReact.Element
:
export default function DangerouslyAccessReactElementInternals_DO_NOT_USE_IN_NEW_CODE<
E: React$ElementType,
P,
>(e: React$Element<E, P>): {
+key: React$Key | null,
+props: P,
+ref: any,
+type: C,
} {
return e;
}
- Conditional types will now only distribute over a union if
A
inA extends B ? C : D
is a generic type. This is a behavior change that might cause new errors (example). Previously, we distribute over unions in more cases, which contradicts what we said in the docs, and caused some weird behavior that's fixed in this version. - If an exported class contains unannotated
propTypes
, Flow will now emitsignature-verification-failure
.
New Features:
- Hovering on enum members in IDE now show documentation if it's available.
- Added
casting_syntax
option which can becolon
(current),as
, orboth
. If setting isboth
, both(x: T)
andx as T
are allowed. If set tocolon
oras
, only(x: T)
andx as T
are allowed respectively.
Notable bug fixes:
- Previously, when Flow cannot decide which branch to take in a generic conditional type, Flow will produce a abstract type that's unusable almost everywhere. Now Flow will still produce an abstract type, but it will be bounded above by a union type of both branches of conditional type. example.
Misc:
- Flow's insert type quickfix in IDE will stop inserting very specific
React.Element
types. Instead, it will insert general types likeReact.MixedElement
.
Library Definitions:
- Add type definition for
CanvasRenderingContext2D.roundRect
. - Add
tagName
to DOM element declarations (thanks @aselbie).
v0.218.1
New Features:
- Error collation during rechecks should become faster thanks to incremental computation. (Available with the flag
--incremental-error-collation
.)
v0.218.0
Likely to cause new Flow errors:
- We start to validate variance inside
$ReadOnly
, which is previously completely unchecked. It also results in Flow complaining about some incorrect bounds. example
New Features:
- Hover types will now show a specialized version of the callee expression at a call to a generic or intersection-typed function.
Notable bug fixes:
- improve coverage accuracy for the element access portion on element calls,
obj[m](arg)
.
Misc:
- We slightly optimized Flow's performance of subtyping check between two union types.
Library Definitions:
- Add defintions
Array.prototype.findLastIndex()
,String.prototype.at()
,TypedArray.prototype.at()
andObject.hasOwn()
(thanks @pascalduez). - Update
URL
defintions (thanks @pascalduez). - Add typing for cause option in Error constructor.
v0.217.2
This is same as 0.217.1, but we have some issue publishing 0.217.1 to npm, so we will publish this new version instead.
v0.217.1
Notable bug fixes:
- Previously, while global find ref/rename (
experimental.global_find_ref=true
/experimental.global_rename=true
) is ongoing, all other IDE services will be blocked. We fixed it so that other IDE requests can still be served.
v0.217.0
Likely to cause new Flow errors:
- Flow will now ban variance annotations in function or function type parameters. example
React.Element
is now opaque, but we still expose some of its internal structure via the bound on the opaque type. You should not depend on the internal structure. In a future release, we plan to makeReact.Element
truly opaque.- Fixed an issue with implicit instantiation in operations over unions that caused many errors to be missed.
- Changed the ref params on
forwardRef
anduseImperativeHandle
to be write-only. Patterns that rely on refining these params to an object and reading the ref field are misusing these APIs. example React.ElementProps
is now more precise when applied toAbstractComponent
s, resulting in the config type of the component rather thanmixed
. This will cause errors when elements of components with different props are passed intoReact.Element<>
types.
Parser:
- We now parse type arguments after
typeof
annotations. e.g.typeof MyGenericClass<string, number>
. Type checking for this syntax is still not supported.
Library Definitions:
- Update
URLSearchParams
definitions (thanks @pascalduez). - Update
AbortSignal
definitions (thanks @pascalduez). - Add
Array
copying methods (toReversed
,toSorted
,toSpliced
andwith
) the$ReadOnlyArray
class definitions (thanks @pascalduez).
v0.216.1
Notable bug fixes:
- We fixed local find references for namespace imported variables. It will no longer error or return empty results.
v0.216.0
Likely to cause new Flow errors:
- The ability to configure
module.system.haste.use_name_reducers=false
is removed. For now this option defaults totrue
and can only be set totrue
. The option to set the only possible value will be removed in a future release.
Notable bug fixes:
- Fixed cases where hovering over a parser error could cause the Flow server to appear to hang.
Library Definitions:
- Add
USB
web API definitions.
v0.215.1
Notable bug fixes:
- We fixed a bug that causes us to insert extra quote in autocomplete string literal in indexed access types.
v0.215.0
Likely to cause new Flow errors:
- Improved analysis determining if a function has an implicit void return. As a result, some incorrectly typed code will no longer type check. (example)
- Fixed a bug where global assignments in generics wouldn't flag errors. (example)
New features:
- Flow now supports contextual typing for class private property assignments. (example)
IDE:
- Local find all references will now return a more comprehensive result list.
- Go to definition now supports indexed access types.
Library Definitions: