v0.246.0
facebook-github-bot
released this
13 Sep 23:01
·
205 commits
to main
since this release
Likely to cause new Flow errors:
- Support for $ObjMap has been completely removed. This change means that:
$ObjMap
will resolve to a user-defined$ObjMap
global if it's available in your libdef. You can usetype $ObjMap<O, F> = {[K in keyof O]: $Call<F, O[K]>}
to get most of the same behavior, except that in the mapped type versionO[K]
will include void for optional props. Please note that this should be considered as a permanent shim, because we intend to eventually remove$Call
.flow codemod key-mirror
command was removed, since this codemod tries to convert$ObjMap
to$KeyMirror
deprecated-type-objmap
lint was removed.
- Component syntax components without ref prop will have
void
as the instance, soReact.ElementRef<component>
of such component will return void.
New Features:
- Mapped types now support array and tuple types in the form of
{[K in keyof <array or tuple type>: <mapped type>}
.- With this support, we intend to deprecate $TupleMap in the next release and remove the support for $TupleMap eventually
- You can now refine against variables and member expressions with a literal type, not just literal themselves.
Notable bug fixes:
- Flow now only reports one error when two disjoint large enum-like unions are compared (example).
IDE:
- Code actions on component syntax components will produce smaller targeted edits, rather than reprint the entire component.
- Deprecated utility type like $Call are no longer suggested in autocomplete.
- Flow will now provide a quick fix when the spread prop of a component with component syntax redefines some already defined props.
Library Definitions:
React.Ref
is marked as deprecated. UseReact.RefSetter
instead for ref props, andReact.RefObject
for returns ofuseRef
.React.RefSetter
now includes null and void.Promise.all
andPromise.allSettled
have been updated to use mapped type instead of$TupleMap
. The requirement on the type arguments are slightly changed.