Likely to cause new Flow errors:
Function.prototype.bindis now typed with TypeScript'sCallableFunction.bindoverloads, so errors in bound arguments are reported atbind, and a bound function's remaining parameters are a tuple type.FunctionandObjectno longer meananyand no longer triggerunclear-typeerrors. They are now interpreted as the prototypes of functions and objects. Code that assumed they meantanymay get new errors.- Internal type
Function$Prototype$Bindis removed. - Class method
bindnow uses the declaredFunction.prototype.bindoverloads. Bound methods may now report tuple arity errors when used as callbacks that ignore extra arguments or omit nullable parameters, because their inferred parameters are represented as tuple rest parameters.
New Features:
- Support assertion functions. If you relied on Flow's special handling of
invariant, give it anassertssignature. - Execute runtime Flow syntax in CommonJS and ES modules with original stack locations through
flow-node. - Support assertion narrowing through
thisandsuper, including receiver assertions. Readonlynow supportsArrayandReadonlyArraytypes.
Notable bug fixes:
- Honor opaque upper bounds in template interpolation and nullable subtyping.
- Preserve nominal opaque inference when checking nullable targets.
- Fixed spurious
Recursion limit exceedederrors when checking conditions,matchand other expressions whose type is a trivially recursive generic type alias. - Prevent unsound assertion narrowing when annotations refer to shadowed local declarations.
- Qualified type references through a union of namespaces (e.g.
(cond ? A : B).Tvia a local) now look up the type in each namespace instead of reporting it as missing. - Prevent saved-state startup and incremental match checking from crashing when a recheck is canceled.
Misc:
- Document assertion functions.
Parser:
- Add missing AST fields and node types to the Flow parser output.
implicitDeclareis now omitted unlesstrue. - Emit
TypeParameter.boundas a bare type node ornullin ESTree output. Babel output retains theTypeAnnotationwrapper, and the TypeScript-to-Flow API translator generatesextendsbounds. - ESTree enum declarations now use a unified
EnumBodynode with string-or-nullexplicitType. Babel output retains its existing enum body types. - Parse typed function overload signatures in TypeScript implementation files.
- Parse destructured parameters in TypeScript function types outside declaration files.
- Parse optional class method signatures in JavaScript and TypeScript files.
- Parse optional TypeScript constructor parameter properties.
- Parse namespace export aliases and ambient exported members in TypeScript definitions.
- Fix parsing of class modifiers before synchronous generator methods.
- Support
readonly T[]in unlabeled tuple elements and require parentheses when optional.
Library Definitions:
- Add
Intl.SegmenterandIntl.supportedValuesOf. - Add
Intl.NumberFormat.prototype.formatRangeandformatRangeToParts, and the ES2023NumberFormatoptions;formatacceptsbigintand numeric strings. String.prototype.localeCompare,toLocaleLowerCaseandtoLocaleUpperCaseacceptIntl.LocalesArgument;matchAllwith aRegExpreturnsRegExpExecArraymatches.Float16Array.prototype.toLocaleStringtakesIntl.NumberFormatOptions.- Add ES2024
ArrayBufferresizing, transfer, and constructor options. - Align
ReflectAPIs with TypeScript property, descriptor, key, and constructor definitions. - Reuse TypeScript's
Float16Arraydeclarations while preserving Flow covariance and callback compatibility. - Align
ProxyAPIs with TypeScript and check array elements against numeric interface indexers.