GeezerVison is showing github.com — Releases · meta/flow
Releases · meta/flow
v0.340.0
gkz
released this
12 Nov 08:14
Likely to cause new Flow errors:
- Class component configs are computed with
React.ReactManagedAttributes
- Errors on keys read from
keyof over an object with an indexer are now reported at the use of the key instead of at the indexer
- Arguments of
Object static method calls that Flow doesn't type specially now get contextual types from the method's signature, like other method calls.
use() calls in functions that Flow can't place in a component or hook now get the react-rule-hook-conditional error code instead of react-rule-hook.
- JSX intrinsics are typed by
React.JSX.IntrinsicElements instead of $JSXIntrinsics, which Flow no longer reads. experimental.jsx_intrinsic_elements only accepts true.
- Class component configs always merge default props with
React.ReactManagedAttributes. experimental.react_managed_attributes only accepts true.
New Features:
- Support fractional and other finite numeric property keys in Flow, using JavaScript property-name stringification.
Notable bug fixes:
!= null and truthiness refinements remove null and undefined from unions with optional or nested maybe members also when the union is optimized
- Truthiness and falsiness refinements filter intersection members represented by chains of type variables
- Methods of an interface with a construct signature, such as
Number.isFinite and Date.parse, can be read without their receiver, like class statics.
- Reading
prototype from a function or a callable object that doesn't declare it gives any, as declared by the builtin Function, instead of a prop-missing error
- Preserve nominal and intrinsic render types in match pattern bindings.
flow-node no longer drops script arguments that equal a Node option passed before the script path.
flow-upgrade adds the nameFunctionTypeParams and nameIndexerKeys codemods, and removeExplicitlyExactObjectTypeSyntax also removes ambiguous-object-type lint comments.
Parser:
- Parse TypeScript's definite assignment assertions on class fields,
value!: T, and variables, let x!: T
- Fixed parse time that doubled with each level of nested conditional expressions with parenthesized consequents
PropertyDescriptor and PropertyDescriptorMap are now interfaces, as in TypeScript
Object is now declared as interface Object + interface ObjectConstructor, as in TypeScript
Function is now declared as interface Function + interface FunctionConstructor, with CallableFunction and NewableFunction, as in TypeScript
Assets
7
Loading
Uh oh!
There was an error while loading. Please reload this page.
v0.339.0
Breaking Changes:
- Rename
typeParameters to typeArguments on ESTree GenericTypeAnnotation, InterfaceExtends, and ClassImplements, including WASM flow-parser output. Declaration parameters and Babel output retain their existing names.
PropertyDescriptor and Object.getOwnPropertyDescriptor are no longer generic. Remove type arguments from PropertyDescriptor<T> annotations and Object.getOwnPropertyDescriptor<T>(...) calls.
Likely to cause new Flow errors:
- Hook calls in classes now use
react-rule-hook-class, and calls in deeper nested anonymous callbacks inside components or hooks use react-rule-hook-conditional, instead of react-rule-hook. Update suppressions to the new codes. Hook calls directly in class property initializers are also rejected when the enclosing function would otherwise permit them.
- Assignments and throws in function or component parameter defaults and destructuring defaults are now treated as conditional, because a default only runs when the value it replaces is
undefined.
- Property increments and decrements (
o.x++, o.x--, ++o.x, and --o.x) now invalidate narrowings of the property through aliases, as assignments already do.
- Reads in an assertion call's condition now use the types at the point where they run, rather than types after the call and its later arguments. This removes false errors and reports reads before a later argument assigns a variable.
break, continue, return, and throw paths through finally are no longer dropped. Flow now reports variables left unassigned and narrowings that do not hold on these paths.
- Optional class fields (
x?: T, with experimental.tslib_syntax) now have type T | void. Reads may return undefined, and assigning undefined is allowed.
- Type parameters explicitly declared
in out in TypeScript files are now invariant rather than covariant.
- Functions named
use* declared in TypeScript files are now treated as hooks. This fixes calls from Flow hook syntax, but calls outside a component or hook can now report Rules of Hooks errors.
parseInt, parseFloat, and eval now require a string; isNaN and isFinite require a number; and builtin Error constructors require a string message, matching TypeScript.
Object.getOwnPropertyDescriptor, Object.defineProperty, Object.prototype.hasOwnProperty, and Object.prototype.propertyIsEnumerable now require PropertyKey (string | number | symbol) keys. PropertyDescriptorMap is also keyed by PropertyKey.
DataView.byteLength and byteOffset, numeric typed array byteLength, byteOffset, and length, and RegExp.source, global, ignoreCase, and multiline are now read-only. RegExp.prototype.compile now requires a pattern.
Array.prototype.splice uses separate removal and insertion overloads, so inserting items requires a deleteCount.
Array and ReadonlyArray reduce and reduceRight now have an overload whose initial value and accumulator use the element type. Calls intending a different accumulator type may need an explicit type argument, e.g. reduce<number>(...).
Promise.prototype.then and catch now use TypeScript-style signatures. then has separate fulfillment and rejection type parameters; calls whose inferred result is unsuitable may need explicit type arguments.
RegExpMatchArray.index and input are now optional, and its first element is declared as 0: string. Check optional fields on match results, and use RegExpExecArray for exec and matchAll results.
Error.stack is now optional, matching TypeScript.
- Numeric typed array
subarray methods, including Uint8Array.prototype.subarray, return their corresponding typed array rather than this. Subclasses that return their own type should declare their own override.
New Features:
- Format code with Prettier in the Try Flow playground, and copy JSON from its AST view.
- Object type spreads allow optional properties after an object with an indexer. Value spreads retain their existing checks.
- Add
translateFlowTypeToTSType to flow-api-translator for type-node translation.
- Functions with any return type are accepted where a TypeScript-declared function type returning
void is expected, matching TypeScript. Flow-declared function types retain their existing return checks.
Notable bug fixes:
- Fixed Windows commands such as
flow check hanging when their output is piped or captured, even after the command exits (#9519).
- Preserve imported TypeScript template literal types without requiring
experimental.tslib_syntax.
- Type guards refine distinct bigint literal types to
empty, as they already do for string, number, and boolean literals.
- Fixed an internal error when a function parameter default always throws; the function is now typed and checked.
- JavaScript objects with extra properties can be checked against TypeScript object types whose index signature applies to only some keys, and against interfaces extending an object type with an index signature.
- Accept literal initializers such as
declare const x = -1.
- Improve implicit instantiation through conditional types without
infer, conditional types nested inside distributive conditional types, and type applications that expand to types mentioning the inferred parameters.
- Fixed a crash when a mapped type's key has the same name as a type parameter spread in the mapped object type.
- Imports such as
.//foo and ..//foo resolve like ./foo and ../foo.
- Prevent stack overflows and spurious internal errors when checking recursive tuple spreads in generic type arguments.
- JavaScript subclasses can override static methods of TypeScript classes with narrower parameters, as on the instance side.
- Fixed a crash on a
match in unreachable code.
- Fixed a crash when a namespace merged with a class or function redeclares one of its members.
- Fixed crashes when a recheck is canceled while checking a component declaration, or when cancellation or a timeout interrupts a type cast from an annotated source.
- Fixed a crash on a method with a
this parameter in a class expression or a class declared in a callback.
- Fixed a crash when a file imports a name that it also declares as a function, component, or hook.
- Fixed crashes when a library definition stops parsing while the server is running, or contains an ignored statement that reads a name, such as
f();.
- TypeScript enum checking no longer requires
enums=true.
- Fixed a crash ("Non speculating: LimitExceeded") when destructuring a value whose type lookup exceeds the recursion limit.
- A type parameter whose bound mentions another type parameter no longer leaks unresolved into the other parameter's solution.
- A field named
constructor, including TypeScript's ['constructor'] fields, now types x.constructor without shadowing the constructor used by new and super().
- Named imports work from CommonJS modules whose
module.exports has multiple call signatures or is an overloaded function merged with a namespace.
- Mapped types with template literal keys now produce individual properties when their placeholders resolve to string literals, instead of retaining a template literal indexer. Generic placeholders and unsupported intersection or recursive-alias cases retain their existing behavior.
flow-upgrade transformations preserve type arguments with both legacy and current parser AST fields.
Misc:
- Implements errors print the implemented interface's type and type arguments instead of generic descriptions such as "exports".
- Try Flow disables Clear and Copy code when the editor is empty, keeps the Format button stable as saved-state controls change, and places the AST format selector after its hide options.
- Tooling documentation recommends
flow-parser and Prettier's built-in Flow parser without an external parser plugin.
Parser:
Program source locations and ranges span the entire input, including whitespace and comments.
flow-parser preserves optionality on constructor parameter properties.
- Correct
flow-estree types for unannotated object type properties, readonly type operators, combined in out variance, optional Program.tokens, sparse-array elements, and JSX namespaced attributes. Sparse-array parent repair and traversal preserve holes.
- Omit absent
typeof type arguments from ESTree output, including WASM-decoded nodes and detached builders.
- Default interface exports have the correct type-only export kind and AST typings. Type stripping removes the complete export wrapper rather than leaving a dangling
export default.
flow-parser type stripping preserves function parameter defaults and side-effect imports.
flow-transform preserves leading #! lines.
flow-eslint scope analysis handles TypeScript parameter properties, class member decorators, and declare global.
- Type translation preserves readonly array and tuple operands, inline interface bodies, and qualified interface bases.
- Type translation tracks required React imports for JSX-qualified types.
- Strict TypeScript translation rejects unsupported generic indexer keys instead of silently losing qualification or type arguments. Recovering string-API behavior is unchanged.
IDE:
- Hover on calls to polymorphic functions, including functions bound by
const, properties, or parameters, and on construction of polymorphic classes shows the instantiated type arguments.
- Multiline unions and intersections in hover types are indented under their annotation, one member per line.
- Hover,
dump-types, and error messages print any without its kind, e.g. any instead of any (explicit).
Library Definitions:
encodeURIComponent also accepts numbers and booleans.
Symbol.prototype.valueOf returns symbol instead of ?symbol.
arguments.callee and Function.prototype.caller are typed as Function, and function prototype properties a...
Read more
Assets
7
Loading
Uh oh!
There was an error while loading. Please reload this page.
v0.338.0
Breaking Changes:
- Flowconfig option
experimental.assertion_functions is removed. Assertion functions have been on by default and the option only accepted true since 0.337.
- Flowconfig option
experimental.disable_invariant_special_casing is removed. It has been on by default and only accepted true since 0.337.
- Flowconfig option
experimental.function_and_object_type_is_no_longer_any is removed. It has been on by default and only accepted true for a while.
- Flowconfig option
experimental.builtin_ts_libdef_dynamic_discovery is removed. It has been on by default and only accepted true.
- Flowconfig option
experimental.declare_global_support is removed. It has been on by default and only accepted true.
Likely to cause new Flow errors:
Readonly, Partial, Required, $Exact, Omit and mapped types over an interface now include its methods and the members it inherits.
- Type guards now refine
Array<any>, {data: any}, Map<string, any> and similar types to the guarded type, e.g. Array<string>, which can surface errors in code that relied on any.
- Static members can no longer reference the type parameters of their class, like in TypeScript, and reading a static member of a generic class no longer infers them.
keyof of an object with a template literal indexer no longer widens the indexer key to string in conditional types like Exclude.
New Features:
- Mapped types over arrays and tuples support
readonly and writeonly modifiers.
- Property truthiness checks such as
if (result.done) now refine unions of classes and interfaces by fields with literal types, as === checks already did.
- Type guards narrow through optional calls such as
isString?.(x). When the callee or receiver is nullable, only the true branch narrows.
- Support optional assertion calls when their declared types guarantee the call runs.
- Added the intrinsic
ExactObjectType, the supertype of every exact object type and a subtype of {...}.
Notable bug fixes:
- Fix crashes and false recursive-definition errors from cyclic type star exports in TypeScript declarations.
- Support namespace export aliases and ambient exported members in TypeScript definitions.
- Allow classes to extend a constructor whose overloads are not all generic, such as
Uint8Array<ArrayBuffer>.
- Casting a value whose type intersects an enum with other types (e.g.
E & E) to the enum's representation type no longer errors.
- Arrays can be assigned to variables and parameters whose type was inferred from
new Array<T>(...).
- Report delegated yield type errors at the yield expression.
- Align Try Flow's default lints and
declare global support with regular Flow.
- Improve inference for generic values passed to polymorphic operations.
- Fix Try Flow initialization after the async builtin migration while preserving older releases' library definitions.
- Report conditional type instantiation errors at the caller.
- Apply type-parameter defaults when omitted optional or nullable arguments are the only evidence for them.
- An object with an indexer is no longer checked against optional properties it doesn't declare of a TypeScript-declared (
.d.ts) object type, matching TypeScript.
- Fewer
underconstrained-implicit-instantiation errors for generic calls passed as arguments to other generic calls.
- Fixed a crash when printing long types that contain non-ASCII names in error messages.
- Tuple types with a spread keep the variance of their own elements, e.g.
a in [readonly a: unknown, ...T] stays read-only.
First in [infer First, ...infer Rest] is now inferred instead of unknown.
- Fixed a deadlock in the Flow server monitor that could make all subsequent commands fail with "Out of retries, exiting!".
- Type guards with a union type now refine union members precisely, e.g. a falsy-value guard on
string | number refines to "" | 0.
- Type guards now drop union members that are instances of classes unrelated to the guarded class, e.g.
x: A | B refined by x is A is now A rather than A | (A & B).
- The negative branch of a type guard now refines away generics that satisfy the guard, e.g.
x: T | number refined by !isT(x) with isT: (x: unknown) => x is T is now number.
- In the negative branch of a type guard,
any now stays any instead of becoming empty, and boolean is refined to the literal the guard does not cover.
- Correct stdin behavior for
flow check-contents and flow autocomplete.
- Error messages print code that contains backticks, such as template literals, as markdown code spans.
- Instances of TypeScript-declared generics, such as
React.MouseEvent<T>, now compare type parameters without a variance annotation covariantly, as type applications already did.
- Type guards now drop tuple members of a different length and array members with disjoint element types.
- Type guards now drop object and interface union members whose properties conflict with the guard type.
x instanceof C no longer refines a value of an intersection type to empty.
- Linux release builds use jemalloc, which keeps the memory of long-running servers from growing after large rechecks.
- Fixed a race that could leave a file unmerged after a recheck, which made the server recheck forever while an open file imported it.
Misc:
- Print rest arrays as array types in errors.
- Print receiver and merged declaration types in errors.
- Simplify missing this annotation diagnostics.
- Print both types in inheritance errors.
- Identify missing parameter annotations directly at the parameter location.
- Remove empty filename metadata from the Try Flow AST display.
- Add a default-on option to hide locations in the Try Flow AST pane.
- Show node types first in the Try Flow AST pane.
- Add a default-on option to hide null and undefined fields in the Try Flow AST pane.
- Move Try Flow's JSON error output into an Errors format pill bar.
- Add JSON AST output to Try Flow.
Parser:
- Accept explicit semicolons on shorthand ambient modules.
- Accept keyword members in qualified type names and import types.
- Allow repeated inline interface exports in TypeScript files.
- Fixed
flow-parser taking minutes to parse JS files over ~1 MB.
- Support destructured rest parameters in function type signatures.
- Support import attributes on re-export declarations.
- Preserve TypeScript accessibility modifiers on bodyless class method signatures.
- Preserve computed type-literal keys as properties in TypeScript source files.
- Allow newline-separated type members in TypeScript source files.
- Use
"in out" for the ESTree variance kind of in out type parameters.
- Parse postfix non-null assertions with type syntax enabled, preserve ASI, and emit TypeScript-compatible
NonNullExpression nodes.
- Respect JavaScript line terminators and Unicode whitespace when recovering source locations.
- Parse default interface exports and report unsupported syntax during type checking.
- Correct inferred ESTree source type for default interfaces, inline type specifiers, and exported import aliases.
- Exclude default interface exports and all-type specifier lists from inferred Babel module source type.
- Support top-level await for explicit modules and
.mjs/.mts files in flow-parser.
- Always enable type parsing for TypeScript filenames.
- Reject type syntax in untyped parser mode and report precise diagnostics.
- Fix declaration method signature locations to include the complete signature.
- Include the
const keyword in const enum declaration locations.
IDE:
- Hover and error messages no longer print redundant parentheses around function types in maybe types, e.g.
?() => void instead of ?(() => void).
Library Definitions:
- Align well-known symbol members (
Symbol.toStringTag, Symbol.match, Symbol.toPrimitive, ...) with TypeScript.
Map and WeakMap set, and Set and WeakSet add, now return this.
RegExp flags/sticky/unicode and Number.EPSILON/MAX_SAFE_INTEGER/MIN_SAFE_INTEGER are now read-only; String.prototype.normalize accepts the normalization form literals and the legacy HTML methods (bold, link, ...) are declared.
Array.prototype.copyWithin returns this, so subclasses of Array keep their type.
Array.prototype.sort returns this, so subclasses of Array keep their type.
Math constants (Math.PI, Math.E, ...) are read-only.
Number.MAX_VALUE, MIN_VALUE, NaN, NEGATIVE_INFINITY and POSITIVE_INFINITY are read-only.
String#split requires a separator, String#replace has separate overloads for a string and a function replacement, and String#length is read-only, as in TypeScript.
- Use TypeScript's ES2018 async iterator and iterable definitions.
- Use TypeScript's ES2018 async generator definitions.
- Use TypeScript's ES2019 array definitions while preserving Flow's existing
flatMap union order and inference.
- Use TypeScript's ES2020 promise definitions, including mutable settled results.
- Use TypeScript's ES2016 array
includes definitions while keeping Flow's element refinement.
- Use TypeScript's ES2015 generator definitions.
Generator.prototype.return now requires a value of the generator's return type.
- Add
React.CSSProperties, typed by csstype.
- Use TypeScript's ES2015 promise definitions, adapted to Flow's inference.
- Use TypeScript's ESNext set method definitions, including
Set.prototype.union.
- Use TypeScript's ES2015
Map, Set, WeakMap and WeakSet definitions. size is now read-only.
done is now optional in the non-final branch of IteratorResult, as in TypeScript.
- Use TypeScript's ES2015 iterable definitions.
ArrayIterator, MapIterator, SetIterator and StringIterator are now interfaces, and StringIterator takes a type argument.
- Add React's DOM types from
@types/react, such as React.MouseEvent, React.HTMLAttributes and React.JSX.IntrinsicElements.
React.ComponentProps of a string that is...
Read more
Assets
7
Loading
Uh oh!
There was an error while loading. Please reload this page.
war59312 reacted with thumbs up emoji
1 person reacted
v0.337.0
Likely to cause new Flow errors:
Function.prototype.bind is now typed with TypeScript's CallableFunction.bind overloads, so errors in bound arguments are reported at bind, and a bound function's remaining parameters are a tuple type.
Function and Object no longer mean any and no longer trigger unclear-type errors. They are now interpreted as the prototypes of functions and objects. Code that assumed they meant any may get new errors.
- Internal type
Function$Prototype$Bind is removed.
- Class method
bind now uses the declared Function.prototype.bind overloads. 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 an asserts signature.
- Execute runtime Flow syntax in CommonJS and ES modules with original stack locations through
flow-node.
- Support assertion narrowing through
this and super, including receiver assertions.
Readonly now supports Array and ReadonlyArray types.
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 exceeded errors when checking conditions, match and 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).T via 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.
implicitDeclare is now omitted unless true.
- Emit
TypeParameter.bound as a bare type node or null in ESTree output. Babel output retains the TypeAnnotation wrapper, and the TypeScript-to-Flow API translator generates extends bounds.
- ESTree enum declarations now use a unified
EnumBody node with string-or-null explicitType. 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.Segmenter and Intl.supportedValuesOf.
- Add
Intl.NumberFormat.prototype.formatRange and formatRangeToParts, and the ES2023 NumberFormat options; format accepts bigint and numeric strings.
String.prototype.localeCompare, toLocaleLowerCase and toLocaleUpperCase accept Intl.LocalesArgument; matchAll with a RegExp returns RegExpExecArray matches.
Float16Array.prototype.toLocaleString takes Intl.NumberFormatOptions.
- Add ES2024
ArrayBuffer resizing, transfer, and constructor options.
- Align
Reflect APIs with TypeScript property, descriptor, key, and constructor definitions.
- Reuse TypeScript's
Float16Array declarations while preserving Flow covariance and callback compatibility.
- Align
Proxy APIs with TypeScript and check array elements against numeric interface indexers.
Assets
7
Loading
Uh oh!
There was an error while loading. Please reload this page.
v0.336.0
gkz
released this
15 Oct 08:19
Likely to cause new Flow errors:
- Calls such as
Array.from can now infer narrower literal types, requiring explicit annotations where broader types are needed. Unconstrained class type arguments now use their bounds instead of empty.
- Flow now checks
ref compatibility for JSX tags typed as string, exposing refs that assume a more specific element type.
- Explicit
this parameters 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>) => void no longer satisfies (...args: TArgs) => R when TArgs is inferred as Array<unknown> (Try Flow example).
- Rest destructuring of exact tuples, e.g.
const [first, ...rest] = t, now excludes preceding elements' types from rest.
- 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 class now preserves variance annotations.
- Returns inside functions nested in a type guard function are no longer checked against the enclosing type guard.
- References inside
declare namespace blocks now see members merged across blocks and library files.
- Functions and constructors are now accepted as builtin
Function and Object values.
- Fixed spurious indexed-access errors involving recursive class type-argument bounds.
- Type arguments used in later tuple spreads, e.g.
B in [...A, ...B], are now inferred instead of left underconstrained.
- Conditional types using
infer on 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-upgrade now 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 to links no longer include the hovered declaration itself.
Library Definitions:
Intl is now a builtin namespace with TypeScript-compatible definitions through ES2020, including Collator, NumberFormat, DateTimeFormat, PluralRules, RelativeTimeFormat, Locale, DisplayNames, getCanonicalLocales, and formatToParts for dates and numbers.
- The legacy
Intl$CollatorOptions, Intl$DateTimeFormatOptions, and Intl$NumberFormatOptions aliases now match TypeScript. Intl.DateTimeFormatPartTypes includes 'unknown', and locale-aware Date methods accept Intl.LocalesArgument and Intl.DateTimeFormatOptions.
- The global
LocalesArgument type is now Intl.LocalesArgument. Library declarations such as flow-typed's declare var Intl hide the builtin namespace and must be removed.
React.ElementConfig is removed; use React.ComponentProps instead.
- Typed arrays gain
findLast, findLastIndex, toReversed, toSorted, and with, and their constructors can be called without arguments. For types other than Float16Array, findLast narrows its result with a type-guard callback. Callbacks to findLast and findLastIndex can no longer annotate this.
Float16Array now matches TypeScript's declaration, including its from overloads. length, byteLength, and byteOffset are read-only, find and findIndex predicates must return boolean, and callbacks can no longer annotate this.
- 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.errors is now typed any[], matching TypeScript.
- Decorator definitions now match TypeScript:
ClassDecorator accepts classes, decorator context and metadata types are available, and Function includes [Symbol.metadata].
- Add
DisposableStack, AsyncDisposableStack, SuppressedError, Disposable, and AsyncDisposable. AsyncGenerator now extends AsyncIteratorObject and includes [Symbol.asyncDispose].
Assets
7
Loading
Uh oh!
There was an error while loading. Please reload this page.
v0.335.0
Breaking Changes:
- Removed the legacy
builtin_lib=flowlib and builtin_lib=flowlib-with-lib-dom-d-ts options.
- Removed the Flow config options
exact_by_default, experimental.always_generalize_jsx, experimental.fast_symlink_resolution, experimental.importable_global_libdefs, experimental.interface_dictionary_typing_fix, experimental.new_this_typing, experimental.opaque_type_new_bound_syntax, saved_state.allow_reinit, saved_state.direct_serialization, and saved_state.reinit_on_lib_change. These options had been enabled by default and only accepted true.
Likely to cause new Flow errors:
Symbol and Promise now use TypeScript-style instance and constructor interfaces. Code relying on their previous class typing may see different errors.
- Some JSX expressions that were previously considered underconstrained now infer
unknown.
- Fixed type argument inference that incorrectly used a bound or
unknown. More underconstrained errors may appear.
String.prototype.replaceAll now has separate overloads for a replacement string and a replacer function, matching TypeScript. Passing a union of these types is an error.
RegExpMatchArray.groups is now optional and cannot be null, and RegExp.prototype.dotAll is read-only, matching TypeScript.
new $ReadOnlyArray now causes an error.
Symbol() now only accepts a string | number description, and Symbol.keyFor returns string | void, matching TypeScript.
- Deprecated syntax now consistently causes errors, including in library definition files.
- Type arguments of a polymorphic value flowing to a non-polymorphic type are now solved, which can surface previously hidden errors.
React.PropsOf now uses React.ComponentProps to find component props. Additional errors may occur.
New Features:
- Support assertion functions exported through CommonJS, assertion calls in return position, and assertion calls in arrow expression bodies.
- The
undefined type can be used in library definitions, where it means void.
flow-remove-types supports abstract classes, abstract members, override modifiers, satisfies, optional class fields, and additional type-only imports and exports.
- Template literals infer precise types in
const declarations and annotated initializers.
Notable bug fixes:
as const on template literals infers template literal types like TypeScript.
- Implicit instantiation can infer a type argument through
React.ComponentProps and other conditional types with infer.
- Interfaces with construct signatures no longer print a spurious
this parameter in error messages and hovers.
this-typed methods inherited from builtins such as typed arrays now return the subclass.
- Exported
declare class declarations extending builtins such as Error, Map, Set, or Date now inherit the builtin's statics and constructor.
- Arguments of
new X(...) are now contextually typed when X is annotated with the typeof of a constructor interface value.
typeof x === 'function' now refines builtin constructors such as Map and Symbol, and interfaces with call signatures, as functions.
- User-defined assertion conditions check member access in test context.
- Recognize ESM default imports of CommonJS assertion functions and callable objects with
asserts call signatures.
instanceof and declare class ... extends now use the prototype of a constructor interface that has no construct signature, instead of narrowing to empty or reporting "not inheritable".
- Fixed a memory leak in type signature parsing that inflated server memory on large codebases.
- Fixed checking interfaces that extend classes, including object values and multiple generic class supers.
Misc:
React.ElementConfig is deprecated in this version and will be removed in the next version. Use React.ComponentProps instead.
- The
unnecessary-invariant lint is renamed to unnecessary-assertion; the old name is still accepted.
- Constructor errors and variance check errors now print types instead of descriptions such as "object type", "module", or "exports".
- Unary arithmetic on a maybe-typed operand reports
null and void separately instead of "null or undefined".
- Record type utility errors name the utility (
Partial, Required, or mapped type).
Parser:
- Store abstract property annotations in
typeAnnotation and emit value: null.
IDE:
- Hover on flow.org/try now shows types framed as declarations, matching the VS Code extension.
- Autocomplete and go-to-definition on instances of classes extending builtins such as
Map, Set, Error, and Date now show the builtin's instance members.
- JSX attribute autocomplete on a union or intersection of components offers the props of the components the element is checked against.
- Go-to-definition on a JSX attribute of a union or intersection of components uses the props of the components the element is checked against.
- Find-references on a JSX attribute of an intersection of components finds the attributes passed to the branch the element is checked against.
- Qualify
React.ComponentProps in generated type annotations.
Library Definitions:
React.ComponentProps<'div'> now includes the optional ref prop.
- Added
Promise.withResolvers.
- The type parameters of
Map.groupBy are now ordered <K, T>, matching TypeScript.
RegExp.prototype[Symbol.matchAll] is now a method and RegExpStringIterator an interface, matching TypeScript.
Assets
7
Loading
Uh oh!
There was an error while loading. Please reload this page.
v0.334.0
Likely to cause new Flow errors:
- Improved generic type inference with conditional types. Some places might infer a different type and cause new errors.
Number, String, RegExp, Date, native errors, maps, and sets now use TypeScript-style instance and constructor interfaces, while Math, JSON, and Atomics use named interfaces. Existing code relying on their previous class or object typing may produce new errors.
New Features:
- Allow object type spreads over interfaces and inexact object types.
Notable bug fixes:
- Allow classes to extend generic construct-signature interfaces.
- Generic values re-exported through annotated CommonJS getters retain their polymorphic types.
- Preserve record lowering source locations.
- Preserve match lowering source locations.
Parser:
- Support semicolonless abstract method declarations.
Assets
7
Loading
Uh oh!
There was an error while loading. Please reload this page.
v0.333.0
Likely to cause new Flow errors:
- Imports of
react module will always resolve to Flow's builtin react type definitions. If you use a custom react typing module, you might see errors.
Notable bug fixes:
- Preserve Flow WASM linker settings, including memory growth.
- Correct parser ranges for
unique symbol types and signed mapped-property variance.
Parser:
- Rename the
ImportType ESTree field from argument to source.
- Preserve computed object type property keys in parser output.
Library Definitions:
- Flow will now include DOM typing from TypeScript's
lib.dom.d.ts by default. If your project is not supposed to run in the browser, you can switch back to the old behavior with builtin_lib=core-only in flowconfig's [options] section.
- Flow's
Iterable and ArrayLike type now align with those from TypeScript. You might see errors when your existing code assumes the old typing.
Assets
7
Loading
Uh oh!
There was an error while loading. Please reload this page.
v0.332.0
Breaking Changes:
no_flowlib option is removed. Use builtin_lib=flowlib (default) or builtin_lib=prelude instead.
Likely to cause new Flow errors:
- Render types no longer accept exact react element as arguments. See https://flow.org/en/docs/react/render-types/ for supported cases
- Flow will now always infer a react jsx element to be a render type if it's an element of a component-syntax component, or
React.MixedElement otherwise. Legacy code that requires exact react element will see new errors.
- Add an option for rejecting dynamic imports in Haste modules.
New Features:
Symbol() and Symbol.for() create a unique symbol when they initialize a const, so symbols can be used as property keys without explicit declarations.
Notable bug fixes:
- Bound error type normalization to prevent excessive memory use
- Release temporary signature-hash graphs after Flow merges.
- Using
import typeof of a generic value without type arguments keeps its polymorphism instead of reporting missing-type-args, and renders accepts import typeof of a generic component.
Parser:
- Parse deferred imports:
import defer * as ns from "m" and import.defer("m") now set the ESTree phase property to "defer".
IDE:
- Hover on members accessed through
super shows the declaration
- Hover on destructuring keys shows the member declaration
- Hover on enum members shows the member declaration
- Hover on signature labels and indexer keys shows the parameter
- Hover on component attribute names shows the prop declaration
- Hover on import/export sources shows the module
- Hover on this-parameters shows the parameter
- Hover on indexed-access literals shows the member
- Hover on polymorphic JSX elements no longer exposes overly precise literal types when no annotation demands that precision
- Hover on a call to an overloaded function reports how many other signatures the function has
- Hover lists the signatures of an overloaded declaration instead of printing their intersection
- Component hovers no longer drop indexer rest props
- Align multiline union members in hover type declarations
- Render hover definition links in a compact Rust-style navigation row.
- Expand rest-prop aliases in top-level component hovers.
Library Definitions:
- React ref callbacks now have a stricter return type
import.meta will no longer have url property and arbitrary unknown property. To add them back, you can do so through declaration merging (e.g. adding interface ImportMeta { url: string } to your global library definitions.
ArrayLike and ArrayBuffer now follow TypeScript definitions
- Stricter typing for
Array(length) and Array(items)
Assets
7
Loading
Uh oh!
There was an error while loading. Please reload this page.
v0.331.0
Likely to cause new Flow errors:
- Fixed unsound subtyping of instances against indexer in interfaces (example).
- Flow will no longer emit
method-unbinding errors and instead perform stricter this-type checking (example).
IDE:
- Improve the primary type displayed by hover
- Show a single type in
type-at-pos and hover
- Truncate oversized hover types and their reference lists
Library Definitions:
React.ReactElement now matches latest type in @types/react. Added missing React.JSX.Element that makes the type in @types/react .
Assets
7
Loading
Uh oh!
There was an error while loading. Please reload this page.
|