Likely to cause new Flow errors:
- Calls such as
Array.fromcan now infer narrower literal types, requiring explicit annotations where broader types are needed. Unconstrained class type arguments now use their bounds instead ofempty. - Flow now checks
refcompatibility for JSX tags typed asstring, exposing refs that assume a more specific element type. - Explicit
thisparameters on methods in library definitions no longer need to accept the instance type. - Generic rest-parameter inference can now expose previously hidden parameter-type errors. For example,
(input: string, ...args: Array<unknown>) => voidno longer satisfies(...args: TArgs) => RwhenTArgsis inferred asArray<unknown>(Try Flow example). - Rest destructuring of exact tuples, e.g.
const [first, ...rest] = t, now excludes preceding elements' types fromrest. - Variance annotations are now checked through tuple type spreads, so
type T<out X> = [string, ...[X]]is an error.
New Features:
- Support tuple types with trailing rest elements, e.g.
[string, ...Array<number>]. Array literals ending in array spreads and arguments collected by rest parameters can flow to these types.
Notable bug fixes:
- Declaration merging for interfaces and
declare classnow preserves variance annotations. - Returns inside functions nested in a type guard function are no longer checked against the enclosing type guard.
- References inside
declare namespaceblocks now see members merged across blocks and library files. - Functions and constructors are now accepted as builtin
FunctionandObjectvalues. - Fixed spurious indexed-access errors involving recursive class type-argument bounds.
- Type arguments used in later tuple spreads, e.g.
Bin[...A, ...B], are now inferred instead of left underconstrained. - Conditional types using
inferon rest parameters now preserve the matched function's optional parameters and rest element in the inferred tuple, e.g.[number, ...Array<boolean>]. Matching functions with fewer parameters than the pattern and no rest parameter no longer produces underconstrained errors.
Misc:
flow-upgradenow uses Flow parser packages and requires Node 18 and Prettier 3.
Parser:
- Correct JavaScript source columns after characters represented by surrogate pairs.
IDE:
- Hover
Go tolinks no longer include the hovered declaration itself.
Library Definitions:
Intlis now a builtin namespace with TypeScript-compatible definitions through ES2020, includingCollator,NumberFormat,DateTimeFormat,PluralRules,RelativeTimeFormat,Locale,DisplayNames,getCanonicalLocales, andformatToPartsfor dates and numbers.- The legacy
Intl$CollatorOptions,Intl$DateTimeFormatOptions, andIntl$NumberFormatOptionsaliases now match TypeScript.Intl.DateTimeFormatPartTypesincludes'unknown', and locale-awareDatemethods acceptIntl.LocalesArgumentandIntl.DateTimeFormatOptions. - The global
LocalesArgumenttype is nowIntl.LocalesArgument. Library declarations such as flow-typed'sdeclare var Intlhide the builtin namespace and must be removed. React.ElementConfigis removed; useReact.ComponentPropsinstead.- Typed arrays gain
findLast,findLastIndex,toReversed,toSorted, andwith, and their constructors can be called without arguments. For types other thanFloat16Array,findLastnarrows its result with a type-guard callback. Callbacks tofindLastandfindLastIndexcan no longer annotatethis. Float16Arraynow matches TypeScript's declaration, including itsfromoverloads.length,byteLength, andbyteOffsetare read-only,findandfindIndexpredicates must returnboolean, and callbacks can no longer annotatethis.- Add RegExp indices and flags, well-formed string methods, bigint Atomics,
Error.isError,Promise.try,Atomics.pause, and additional ArrayBuffer and Date constructor signatures. - Add TypeScript signatures for
Array.fromAsync. AggregateError.prototype.errorsis now typedany[], matching TypeScript.- Decorator definitions now match TypeScript:
ClassDecoratoraccepts classes, decorator context and metadata types are available, andFunctionincludes[Symbol.metadata]. - Add
DisposableStack,AsyncDisposableStack,SuppressedError,Disposable, andAsyncDisposable.AsyncGeneratornow extendsAsyncIteratorObjectand includes[Symbol.asyncDispose].