NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #3376 most downloaded on npm
JavaScript parser written in OCaml. Produces ESTree AST
Last release 5 days ago
24 Sep 2026
Ships on a steady schedule
a new release about every 2 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
434 releases · first in 2015
Likely to cause new Flow errors:
Likely to cause new Flow errors:
New Features:
--profile mode.Misc:
Likely to cause new Flow errors:
Likely to cause new Flow errors:
this to appear in a constructor before a super call in some cases.typeof may be reported at a different location than they previously were.require() is not allowed.Notable bug fixes:
Misc:
prototype or constructor.Library definition changes:
scrollIntoView to match latest spec.String.prototype.toLocaleLowerCase and toLocaleUpperCase to allow optional locale parameter.Object.prototype.valueOf return mixed instead of Object.Object libdef.TextDecoder to properly accept a BufferSource.MediaStreamTrackEvent definition.String.match return RegExp$matchResult.fs module.One column per quarter.
Likely to cause new Flow errors:
Likely to cause new Flow errors:
// $FlowFixMe) can still suppress a lint at any mentioned location. Depending on your setup, this change may expose Flow lints which were turned off by accident. For example, a "Sketchy Null Check" lint in a file with that lint set to error would have been turned off if it also mentions a file with that lint off. Now that lint will show up as an error.Headers.get and URLSearchParams.get are now annotated to return null | string instead of string and File.lastModifiedDate: any was replaced with File.lastModified: number.Notable bug fixes:
Misc:
BoundT (internal representation of type parameter bounds) smaller.Parser:
extends expression in a class declaration. Moved a couple of properties to their own node.If a server was not already started, running flow status --flowconfig-name 'name' would start a server without taking into account the new flowconfig
Notable bug fixes:
flow status --flowconfig-name 'name'
would start a server without taking into account the new flowconfig name. The same
is true for running flow without any command specified. This changes this by
passing the name to the new server.Likely to cause new Flow errors:
Likely to cause new Flow errors:
New Features:
--saved-state-no-fallback is passed in which case Flow fails.name field in the [options] portion of .flowconfig.Notable bug fixes:
flow --json with a large error output, by
moving to a tail-recursive implementation.flow suggest.Misc:
React$Context.Provider and
CanvasRenderingContext2D.imageSmoothingQuality.$Shape.types_js.ml, merge_service.ml, rechecker.ml, etc.).Added the `unnecessary-invariant` lint, which will flag uses of invariant when Flow can determine that the predicate must be truthy.
New Features:
unnecessary-invariant lint, which will flag uses of invariant when Flow can determine that the predicate must be truthy.find-refs now traverses union types.--flowconfig-name flag now allows you to specify the name of the flowconfig.file_watcher option for .flowconfig.experimental.cancelable_rechecks=true in .flowconfig.
Note: This feature is experimental. When it stabilizes, the flag will be removed and this feature will be enabled by default.Notable bug fixes:
flow-upgrade should no longer trigger ENOENT on Windows.--profile should no longer throw on Windows.ArrayBuffer's static indexer property is now correctly marked covariant. This should prevent errors like this one.Misc:
Array<T> instead of T[] in JavaScript output.{foo:x} as { foo: x } in JavaScript output, as Prettier does.destroyed to net$Socket.document.scrollingElement.dgram$Socket$rinfo to the Node library definitions.groups property to RegExp$matchResult.Likely to cause new Flow errors:
Likely to cause new Flow errors:
New Features:
[declarations] section in the .flowconfig which can suppress all errors in 1 or more files. Thanks @LegNeato! (#4916)flow server --file-watcher watchman flag which uses Watchman for file watching instead of the builtin file-watcher, dfind--expand-type-aliases flag to type-at-pos. It replaces type aliases with their bodies in the returned type.flow save-state command to generate a saved state file (experimental & loading a saved state isn't ready yet)Notable bug fixes:
type-at-pos for B in import type { A as B } from 'M';find-refs, autocomplete, get-def, etc for $Facebookism$IdxMisc:
type-at-pos output+ operator to match other binary operatorsLikely to cause new Flow errors:
Likely to cause new Flow errors:
require call (use import type instead)Array.of stricter (thanks @wchargin!)New Features:
{| |} as a subtype of { +p?: T }[[call]] syntax in objects and interfacesflow find-refs commandNotable bug fixes:
Misc:
--check flag to flow ast commandfilter property to CanvasRenderingContext2D libdeftimingSafeEqual method to node crypto module (thanks @n-johnson!)Parser:
Decorator node, matching estreeLikely to cause new Flow errors:
Likely to cause new Flow errors:
$ObjMap is used on an exact type).New Features:
Notable bug fixes:
Misc:
ps.max_literal_length option to .flowconfig which replaces a magic constant.find-refs now supports class instances.find-refs on ES6 named exports to improve reliability.react-dom/server libdef.Clients.matchAll to return an Array rather than an Iterator.Parser:
Likely to cause new Flow errors:
Likely to cause new Flow errors:
New Features:
var foo: interface { x: string } = bar;). Will be particularly useful in the future when we revamp object typesNotable bug fixes:
flow find-refs threw an exception when used with an unchecked file. Now it treats the file as if it were checked, like other single-file commands doflow type-at-pos now returns the class name for declare class declarations.Misc:
.mjs to the list of extensions that Flow reads by defaultflow find-refs --multi-hop now parallelizes the work and is much fasterflow find-refs and flow get-def with destructuring patterns as a starting locationflow find-refs with default (as in export default ...) as a starting locationflow find-refs would miss certain locationsflow get-def when used for default and named importsParser:
Made * a deprecated type, under the deprecated-type strict flag.
Likely to cause new Flow errors:
$Exact<empty> as empty. Before, ({p:0}:$Exact<empty>) was not an error due to
missing ground subtyping and decomposition cases. It is now an error.$Either<T>, $All<T> and $Type<T> types are not supported any more.New Features:
multi-hop mode was added that determines when object types are related through subtyping
and links them.Function.prototype.bind as a proto field.* a deprecated type, under the deprecated-type strict flag.--expand-json-output to print an extended JSON output for type-at-pos.onclose to the IDBDatabase interface in lib/indexeddb.js
(reference).onmessageerror to Worker interface and fixed type of MessagePort.onmessage
in lib/bom.js.swap64() to the Buffer type and a Buffer property in lib/node.js.Intl objects for the built-in JS language API (ECMA-402 - Internationalization API).uniform**v setters in lib/dom.js.Notable bug fixes:
Misc:
Object type, "Flow for Atom IDE" in Atom plugins, Flow Strict
and the nonstrict-import lint rule.ocamlbuild).WebGLRenderingContext#is* methods to all return booleans.src/server directory.$Subtype and $Supertype "unclear" types when not in a library context.type-at-pos now prints types at the client-side.Parser:
?? (as above).+ or static inside an object type
(e.g. {+}) are now disallowed.proto modifier in declare class, to specify that the property is
a prototype property instead of a class one.[[new]]).f<T>(x).Likely to cause new Flow errors:
Likely to cause new Flow errors:
number rather than a literal type. This has been fixed.module and exports. The disallowed patterns include computed property
accesses as well as clobbering or aliasing module and/or exports.
experimental.well_formed_exports=true is specified in
.flowconfig.New Features:
Fragment has been added to the default exports of the React libdef.find-refs on a property key in a type declaration will now also yield that key in
object literals.@flow strict-local. This mode is the same as @flow strict, except it
does not require dependencies to also be strict. @flow strict is still the recommended mode, but
@flow strict-local allows enabling strict checking for files before all dependencies can be made
strict. Once all the dependencies are strict, a @flow strict-local file can be upgraded to a
@flow strict file. A @flow strict file cannot depend on a @flow strict-local file.esproposal.optional_chaining=enable in your .flowconfig.
Notable bug fixes:
estree_translator properly handles all cases of the DeclareClass AST node.suggest command has been fixed to work with the new type normalizer.Misc:
find-refs.Parser:
OptionalMember and OptionalCall nodes instead of the existing
Member and Call nodes, and parentheses now correctly limit the scope of short-circuiting.
This reflects the current Babel implementation.The output format with --json-version 2 includes a breaking change, affecting the "context" property in every location. Previously it was just the fir…
Likely to cause new Flow errors:
Promise libdefs for the cases where null or void is passed as callbacks to then
and catch caused us to miss type errors. These libdefs have now been made stricter.this parameters.typeof with speculative typechecking would lead to missed errors, which will now
be reported as expected.module and exports.API changes:
--json-version 2 includes a breaking change, affecting the "context"
property in every location. Previously it was just the first line of the context, which made
printing multi-line errors tricky. Now it includes up to 5 lines of context.New Features:
createContext and createRef APIs introduced in React
16.3.Notable bug fixes:
Misc:
type-at-pos and friends, including converting normalized types back to
AST nodes for printing.find-refs.Array<T> instead of T[].Parser:
implements and mixins fields of the DeclareClass AST node.tokens option to JS API: flow.parse(..., { tokens: true }) will now return the token
stream, like flow ast --tokens does.Fixed a couple bugs in pretty printing errors which could cause flow status to throw an exception
Notable bug fixes:
flow status to throw an exceptionMisc:
Remove special-casing of declare var exports, long deprecated
Likely to cause new Flow errors:
Previously, Flow would allow you to write if (foo.unknownProp) { ... }.
Now Flow disallows testing unknown properties in conditionals. If foo is a
union type like { x: string } | { y: number }, x and y are known
properties and z would be an unknown property
New Features:
Notable bug fixes:
Misc:
declare var exports, long deprecatedRestore accidentally-deleted Object.setPrototypeOf library definition.
Restore accidentally-deleted Object.setPrototypeOf library definition.
Likely to cause new Flow errors:
Likely to cause new Flow errors:
any-typed API definitions with actual types. This may cause errors in code that uses those APIs.New Features:
find-refs now has support for object type properties.Notable bug fixes:
find-refs can now find identifiers used as JSX component classes (e.g. <Foo/>).type-at-pos).Misc:
type-at-pos on method calls that have been affected by type refinements.--profile flag to flow force-recheck.--retry-if-init false.type-at-pos location for opaque type declarations.flow status output when the server is in lazy mode.ReactDOM.hydrate().process.umask's argument optional.Parser:
Error message redesign to help you better debug typing issues in your programs.
find-refs from experimental to beta.find-refs performance by 2x-20x depending on the workload.find-refs.find-refs.type-at-pos and coverage thanks to a type "normalizer" rewrite. Notably, the normalizer and client services like type-at-pos now:
any no longer completely resolve to any. This may uncover new bugs in your programs where some inferred types silently resolved to any.({...null}: {p: number}); incorrectly passed Flow. If you were spreading a maybe-object type then Flow may catch some new bugs in your programs.suppress_comment) will become unused since error locations moved.nonstrict-import lint's error message.React.cloneElement for stateless functional components.--max-warnings flag which allows Flow to exit with a non-zero exit code if warnings are present.--file-watcher flag to ignore file system events.url.format's urlObj argument type.Likely to cause new Flow errors:
Likely to cause new Flow errors:
Improved inference of const bindings (lets and vars that are never reassigned), and introduced similar inference for function params. This allows Flow to be less pessimistic about refinements, especially inside closures. For example:
function f(val) {
if (val == null) return () => 42;
return () => val; // OK, since val cannot be null
}
implements now works on declare class in addition to classdeclare module library definitions are now considered @flow strict@flow strict import rule when in a cycletype-at-pos and coverage commands when they encounter Object.prototype and Function.prototypemerge_timeout .flowconfig option to mirror the --merge-timeout CLI flag added in 0.64implements to DeclareClass nodesLikely to cause new Flow errors:
Likely to cause new Flow errors:
event is no longer recognized as a pre-declared globalNotable bug fixes:
Performance improvements:
Misc:
Parser:
Forgot to cherry-pick a diff to fix flow init, which was generated an invalid .flowconfig
Bug fix:
flow init, which was generated an invalid .flowconfigDeclaring the exported type of a CommonJS module via declare var exports: T is deprecated in favor of declare module.exports: T
Likely to cause new Flow errors:
constdeclare var exports: T is deprecated in favor of declare module.exports: TNotable bug fixes:
any. This avoids cascading internal errors.Misc:
flow get-def (used by IDEs for jump to definition) now behaves differently for variables introduced by an import or require(). Previously, it would show where the variable was created, in the import. Now it looks through the import and shows where the variable was exported.Parser:
static in object typesLikely to cause new Flow errors:
Likely to cause new Flow errors:
unsafe.enable_getters_and_setters option. Getters and setters are now enabled by default. Use the unsafe-getters-setters lint rule to disable.New Features:
flow cycle subcommand, which prints a .dot describing the cycle for a given file.Notable bug fixes:
[lib] files outside the Flow root would not be watched for changesMisc:
nonstrict-import lint rule, which requires that strict files can only depend on other strict files.unsafe-getters-setters lint rule, which replaces the unsafe.enable_getters_and_setters flowconfig option.Parser:
method property to object type property AST node.static for declare class and interfaces.Variance AST node for +/- annotations, matching Babylon.Added an [untyped] section to .flowconfig, which treats all matching files as untyped, as if they did not have @flow. This differs from [ignore] in th
[untyped] section to .flowconfig, which treats all matching files as untyped, as if they did not have @flow. This differs from [ignore] in that [ignore] hides matching files from the module resolver /and/ the type system. This allows you to ignore types from third-party modules that are poorly-typed, typed for a different version of Flow, typed with a .flowconfig with different options, etc.this type is nullable.get-imports command, show every location where a module is imported instead of just one per file.Fixed a bug introduced in 0.60.0 in which Flow would not start if its temp directory did not exist.
Fixed a bug introduced in 0.60.0 in which Flow would not start if its temp directory did not exist.
These changes do not introduce new errors, but error suppressions may need to be moved to the new, more accurate locations.
These changes do not introduce new errors, but error suppressions may need to be moved to the new, more accurate locations.
Introduced a "server monitor" process that acts as an intermediary between client commands and the Flow server.
Previously, the server was only able to service one client request at a time and multiple connections would block until the server is free, preventing the server from telling the waiting clients why it's busy. Now, the monitor can accept many requests and respond more intelligently.
It is also able to detect when the server exits (e.g. when a package.json changes) and restart it transparently.
flow find-refs can now find local references to class properties.
New linters:
unclear-type warns about uses of any, Object and Function, since they unsafely circumvent the type system.untyped-import warns when importing or requireing a module that does not have @flow.Made the union created by $Values on a frozen object maintain singleton literals. That makes this pattern work:
const Enum = Object.freeze({
X: 'x',
Y: 'y',
});
type EnumT = $Values<typeof Enum>
('a': EnumT); // now errors. previously, EnumT was any string
Fixed Object.keys and $Keys on a dictionary of string literal keys, such that the result is now an array of the string literals instead of a generic string:
function f(dict: {['hi']: mixed}) {
(Object.keys(dict): Array<'hi'>);
(Object.keys(dict): Array<'bye'>); // error
}
Simplified the types mentioned in some error messages, like from "type application of polymorphic type: class type: Foo" to just "Foo"
Fixed get-def locations on class and object properties
Fixed get-def on refined object properties like the second prop in if (foo.prop) foo.prop(), which previously returned no results
Fixed non-termination bugs for predicates on classes, unions and polymorphic instanceof
Made recursion limit errors unsuppressable. Please report any such errors, they are always Flow bugs!
lwt from opamflow coverage in --quiet and --json modes--json consistently imply --quiet in all commands, notably status.log.old fileimport type * a parse errorAdds a $ReadOnly utility type which makes all properties on objects read-only. $ReadOnly<{ a: number, b: string }> behaves as if you wrote { +a: numbe
$ReadOnly<T> utility type which makes all properties on objects
read-only. $ReadOnly<{ a: number, b: string }> behaves as if you wrote
{ +a: number, +b: string }. Read more about property variance on
our blog.type O = { a: number, b: string };
function fn(o: $ReadOnly<O>) {
o.a = 42; // Error!
}
class X {
+p: number;
constructor(p: number) {
this.p = p;
}
}
/* flowlint sketchy-null:error */.React.Element to incorrectly point at
library definitions instead of user code.listen() function.declare class with multiple extends is now a parse error.Likely to cause new Flow errors:
Likely to cause new Flow errors:
type Foo = { type: 'A', ... } | { type: 'B', ... }`
function match(foo: Foo) {
switch (foo.type) {
case 'C': ... // dead branch, now error! (was allowed previously)
...
}
}
New Features:
@flow strict instead of
@flow in the header will now additionally fire lint rules that can be listed
in the [strict] section of
.flowconfig. Here are the
current set of supported lint rules (more coming, contributions welcome!).Error reporting:
Parser:
Perf:
Reliability:
flow ideMisc:
flow ls--raw type printingFixed a race condition which was causing the Flow server to hang during merge
Notable bug fixes:
Reverted the change which stopped call properties from flowing to object type dictionaries
Misc:
Fixed a crash when a file goes from parsable to unparsable
Notable bug fixes:
Misc:
Likely to cause new Flow errors:
Likely to cause new Flow errors:
$Diff's implementation was rewritten. It should behave mostly the same, but will error on $Diff<ObjA, {x: string}> if ObjA doesn't have a property xNew Features:
node_modules/ which are direct or transitive dependencies of the non-node_modules code.Notable bug fixes:
flow ide on Windowsflow server to crash when flow ide exitsimport type * syntax$ObjMap's behavior on optional properties$PropertyType, $Diff, and $ObjMap){[string]: boolean} is no longer a subtype of {(number): string}.Misc:
flow server will now write to a log file in addition to stderrflow ls will now list the .flowconfigflow ls will now list lib files, even if --all is not setflow ls --imaginary will list nonexistent files. It's useful for speculating whether or not Flow would care about a file if it existed.flow force-recheck --focus which tells a lazy server to start caring about certain filesAdded a $Rest type, which models the semantics of object rest
New Features:
$Rest<A,B> type, which models the semantics of object restnull prototypes, a la Object.create(null)__proto__ property in object literals and object type annotationsNotable bug fixes:
flow focus-check for multiple filesMisc:
<VERSION> token for suppress_comment option in .flowconfigflow typecheck-contents --graphmlLikely to cause new Flow errors:
Likely to cause new Flow errors:
$ObjMap.New Features:
mixed into an object type.Notable bug fixes:
Misc:
this types are incompatible.mixed not to be properly printed from type-at-pos.Typedefs:
repl module.Parser:
catch.(switch: number) => void).Fixed an issue where the server becomes temporarily unresponsive after a recheck and the client consumes all its retries.
Notable bug fixes:
Likely to cause new Flow errors:
Likely to cause new Flow errors:
class A<T> {}; class B extends A {} is now an error, but class C extends A<string> {} or class D<T> extends A<T> {} is ok.Notable Changes:
type T<Phantom> = any; type X = T<string>; type Y = T<number>, where X and Y are incompatible even though T doesn't use Phantom)fs functionsMisc:
type t = T<U>) with empty type args (e.g. var x: T<>)Parser:
flow ast --strict to parse in strict mode without "use strict"({ x = 1 } = {}), x is 1)let, yield, await, async, super and other reserved wordsnew.target and async methodsFixed a bug that sometimes crashed the server during recheck
Fixed a bug that sometimes crashed the server during recheck
This release includes major changes to Flow's model for React. The following links contain detailed documentation on the new model.
This release includes major changes to Flow's model for React. The following links contain detailed documentation on the new model.
Please use the new flow-upgrade tool to upgrade your codebase to take advantage of these changes!
Likely to cause new Flow errors:
We are modifying how you define React class components. The React.Component class will now take two type arguments, Props and State (as opposed to the three type arguments including DefaultProps that React.Component took before). When your component has no state, you only need to pass in a single type argument. If your component has default props then add a static defaultProps property.
Flow used to not type React function refs at all, but now that we are typing refs code that used to just work may now have errors. One such error which can often be overlooked is that the instance React gives you in a function ref may sometimes be null.
Flow used to completely ignore the type of React children in many
places. Intrinsic elements did not check the type of their children (like
<div>), the type specified by components for React children would be ignored
when you created React elements, and the React.Children API was typed as
any.
In the past when typing children many developers would use an array type (Array<T>) often with the React element type (Array<React.Element<any>>). However, using arrays is problematic because React children are not always an array. To fix this, now use the new React.ChildrenArray<T> type.
New Features:
Notable bug fixes:
function MyComponent(props: {foo: number}) {
// ...
}
<MyComponent foo={undefined} />; // this is now a Flow error
We now allow JSX class components to use exact object types as their props.
We now allow member expressions when creating JSX components,
e.g. <TabBarIOS.Item>.
We now allow multiple spreads in a JSX element.
We have added a type argument to SyntheticEvents and correctly typed
currentTarget using that type argument.
Parser:
Misc:
This release features a major re-architecture in how Flow typechecks modules against their dependencies. Earlier, Flow would do a "local" (per-module) typechecking pass followed by a global (cross-module) typechecking pass. Now, these passes have been merged. This change vastly improve Flow's memory usage on large codebases.
We found and fixed a couple of subtle bugs in the typechecking engine that caused stack overflows in some pathological cases.
We made various improvements to refinements. We now recognize vars that are
only assigned to once as consts, so that we can preserve refinements on them
through longer stretches of code. Some typeof cases have also been fixed.
We now support focus-checking multiple files. You can use it to debug issues easier and faster by telling Flow to focus on files of interest.
This release also includes lots of improvements to core type definitions. Thanks for your contributions!
Flowlint - a linter built into Flow that you can configure to complain about things which aren't quite type errors.
New Features:
Notable bug fixes:
class B<+T> extends A<T> {} when A's type parameter is not covariant)Changed linter (experimental, coming soon) to ignore lint errors in node_modules
Added support for opaque type aliases
New Features:
Notable bug fixes:
Misc:
Parser:
Likely to cause new Flow errors:
Likely to cause new Flow errors:
New Features:
$Values type.Notable bug fixes:
$ReadOnlyArray covariant in variance checking.…soon!) that includes all=false, which is already deprecated. Upcoming versions will support all=off instead.
Fixed an issue where flow init outputs a [lints] section (for experimental linting support, coming soon!) that includes all=false, which is already deprecated. Upcoming versions will support all=off instead.
Optimized performance when typechecking classes
Notable bug fixes:
Misc:
Parser:
Likely to cause new Flow errors:
Likely to cause new Flow errors:
experimental.strict_call_arity option has been removed. For more, see https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/Notable bug fixes:
Misc:
any types and continuing typechecking rather than stopping altogether.Parser:
Likely to cause new Flow errors:
Likely to cause new Flow errors:
React.Component constructor, which means Flow
can now infer the prop types based on the super(props) call in a react
component constructor. This means components that weren't already declaring
their prop types may start getting errors if there are any issues with their
prop types.Promise.prototype.catch, which means code that uses
.catch but wasn't properly handling the exceptional behavior might now have
Flow errorsNew Features:
.flowconfig option experimental.strict_call_arity=true. For more check out this blog postNotable bug fixes:
undefined to unfulfilled parameters.declare class classes would be given a default constructor even if they extended another classMisc:
--no-suppressions with --include-suppressed which is a little bit more well-behaved.--pretty flag to flow check for pretty-printed JSONParser:
declare function declarations with predicatesyield expressions with semicolonsdeclare module declarations[a=1, b] = c was parsed like [a=(1, b)] = c.Flow now has proper unicode support in its parser!
New Features:
import expressions (Thanks deecewan!)export type * from ..., an analogue of export * from ...Notable bug fixes:
Misc:
Parser:
Internally, Flow wasn't always propagating the any type, which could suppress certain errors. We've fixed this, and Flow now notices some errors it wa
New Features:
Notable bug fixes:
Misc:
Fixed parser to disallow variance sigil for when using object spread.
Parser:
Notable bug fixes:
Misc:
Likely to cause new Flow errors:
Likely to cause new Flow errors:
New Features:
type TypeB = { ...TypeA };). You can now spread one object type into another! It is designed to mimic the behavior of spreading an object value in an object initializer, where only own properties are copied over.flow ide command, through which an IDE can establish a permanent connection with Flow. The IDE can send commands through this connection and Flow can push changes to the IDE.Notable bug fixes:
Parser:
Misc:
React.PropTypes.oneOf must take an array of literals. You can now put non-literal values in the array.Fixed an edge case when moving .flow files around in a haste project
Notable bug fixes:
React.createClass() even when they were not needed.this and super in class method parameter defaults.Parser:
Misc:
Likely to cause new Flow errors:
Likely to cause new Flow errors:
// $FlowFixMe (or any kind of suppress_comment), there's a chance the error may have moved out from under the suppression comment. You may see some unused error suppressions and some previously suppressed errors.New Features:
implements - classes can now implement one or more interfaces and Flow will verify that the class properly implements the interfaces.flow find-refs file line column - if there is a variable x at file:line:column, then this command returns the location of x's definition and the location of all reads and writes to x.import {someValue, type someType, typeof someOtherValue} from 'foo'$ReadOnlyArray<T> is the common supertype of arrays and tuples. It's basically an array without stuff like push(), pop(), etcdeclare class, interface's, object types, etc. They're still not safely checked, though.emoji=true in the .flowconfig options and flow status will put emoji in the connection status messages (thanks @zertosh!)Notable bug fixes:
require(), (e.g. require(`foo`))Object.keys no longer returns methods since they are not enumerableT had the type Array<T>. Now it's Array<*>, which lets you add elements of other types to the array.$Shape to ignore "shadow properties", which are properties that don't really exist, but which have been referenced somewhere.unsafe.enable_getters_and_setters=falseMisc:
make no longer complains if js_of_ocaml is not installedflow check --profile now includes CPU timeflow server --profile and flow start --profile now print profiling info to the logstests/ which run a flow server now save the .log file when they fail--no-flowlib, which make them much fasterParser:
kind of a static method named constructor to be "method" rather than "constructor"import type shorthandLikely to cause new Flow errors:
Likely to cause new Flow errors:
// $FlowFixMe (or any kind of suppress_comment), there's a chance the error may have moved out from under the suppression comment to a different location that's more indicative of the error position.New Features:
import type/import typeof inside the body of a declare module to import types between libdefs.Notable bug fixes:
any + number would yield number. Now it correctly yields any.flow check-contents where input is provided via stdin.Misc:
--old-output-format CLI flag is now gone.parse() function in the flow-parser NPM module now takes either 1 or 2 arguments. Previously it would require both arguments in order to work.Likely to cause new Flow errors:
Likely to cause new Flow errors:
New Features:
flow ls --all will output libs and ignored files tooflow ls --explain will explain why Flow cares or doesn't care about a fileflow ls dirA/ dirB file.js will only list files under dirA/, files under dirB/, and file.jsNotable bug fixes:
obj['method']()) is now supported--strip-root set now show context againMisc:
flow coverage and flow check-contents default to treating all input as if it has the @flow pragma. We will change this in a future version. To make this transition easier, both commands now have the flags --all and --respect-pragma, where --all is the current behavior and --respect-pragma is the future behavior.let x = x;Parser:
[...rest, 123] was incorrectly parsedLikely to cause new Flow errors:
Likely to cause new Flow errors:
addEventListener() with 'click' and 'dblclick' will pass a MouseEvent to the listener. This means you might need to update foo.addEventListener('click', (e) => bar()) to foo.addEventListener('click', (e: MouseEvent) => bar()).New Features:
Notable bug fixes:
Misc:
foo has the typed mixed, we now allow foo.bar if you check that foo is not null or undefined.Parser:
let statements, which never made it into the spec (thanks @andreypopp)Likely to cause new Flow errors:
Likely to cause new Flow errors:
{[key: string]: ValueType}) were previously covariant which proved to be a significant source of unsoundness. Dictionary types are now invariant by default in order to fall into consistency with other collection types. It is possible to opt in to explicit covariance with new syntax: {+[key: string]: ValueType}, but note that this is now enforced covariance -- which means the dictionary can no longer be written into (only read from). For mutable collections, consider using Map/Set/etc. Please see this blog post for more information on variance.type T = {+covariantProp: string}. Please see this blog post for more information on variance.type T = {covariantMethod(): string} is the same as type T = {+covariantMethod: () => string}. Please see this blog post for more information on variance.New features:
empty type annotation. This is the "bottom type" which is the type that has no possible values. This is mostly useful for asserting impossible types right now (see the commit description for more details).--quiet flag to suppress server-status information that would otherwise be printed to stderr.React.createElement. See the commit message for more details.for-await-of statements.Notable bug fixes:
get-def and autocomplete on specifiers in import statements now works properly and links in to where the specifier is exported in the other file.Generator.prototype.return now returns a possibly-unfinished IteratorResult object rather than a definitely-done iterator result. See #2589 for more details.munge_underscores config option is set to true.Misc:
yield expressions no longer evaluate to an optional type. This is unsound, but the inconvenience was so prevalent that we decided to relax the issue for now. See #2080 for more details.Parser breaking changes:
ExportNamedDeclaration and ExportDefaultDeclaration nodes from ESTree rather than the outdated ExportDeclaration node.export default class {} now correctly emits a ClassDeclaration rather than ClassExpression per this estree issue.ExportSpecifier property names from id -> local and name -> exported per the latest ESTree spec.ExportBatchSpecifier to a ExportNamespaceSpecifier node per the latest ESTree spec.SpreadElementPattern -> RestElement per the latest ESTree spec.ObjectPattern are now named Property and RestProperty per the latest ESTree spec.Super node now instead of an Identifier node per the latest ESTree spec.{ImportNamedSpecifier and ImportDefaultSpecifier nodes now use proper local and remote property names, per the latest ESTree spec.mixed type annotation is now represented with a special MixedTypeAnnotation node (same as Babylon has been for a while).NullTypeAnnotation annotation node is now called NullLiteralTypeAnnotation in order to match Babylon.Likely to cause new Flow errors:
Likely to cause new Flow errors:
mixed to numberNew features:
suppress_comment now defaults to matching // $FlowFixMe if there are no suppress_comments listed in a .flowconfigpackage.json file is changedPromise.all() (thanks @vkurchatkin!)Notable bug fixes:
Function.prototype and Object.prototypeflow get-def wouldn't hop to the location of a type coming through an import typeany-typed variable as a computed-property lookup results in the wrong property-value typethrows at the toplevel of a module[libs] with an extension not listed in module.file_exts, it would previously be silently ignoredimport * as on a declare module.exports: any; libdef would not result in a module with every possible named export"JSX attributes must only be assigned a non-empty expression" syntax errors sometimes point to the wrong lineget or set in object short notationx = { async 123() { await y; } }u regex flagMisc:
new.target--pretty flag to all commands that have a --json flagflow coverage when --json is passed (thanks @aackerman!)Parser breaking changes:
SwitchStatementguardedHandlers from TryStatementAssignmentPattern for function param defaults to match ESTreeRestElement for function rest params to match ESTreeExpressionStatementCallExpression and MemberExpressionLikely to cause new Flow errors:
Likely to cause new Flow errors:
obj has a property foo that Flow doesn't know about, Flow will now refine obj.foo to the type mixed. If you then try to use obj.foo in an unsafe way (like as a function), you might start seeing errors mentioning property `foo` of unknown type. The fix is to either fix the type of obj to include an optional property foo, or to rewrite code like obj.foo && obj.foo(x) to typeof obj.foo === "function" && obj.foo(x)Array.prototype.find to reflect the fact that it can return undefinedNew Features:
{| and |} instead of { and }. Where {x: string} contains at least the property x, {| x: string |} contains ONLY the property x..css, .jpg, .png, .gif, .eot, .svg, .ttf, .woff, .woff2, .mp4 and .webm files (this list is not configurable at the moment). We call them resource files. If you require a resource file, you get a string (except for .css files, for which you get an Object). You should still be able to use module.name_mapper to map a resource file to a mock, if you prefer.flow gen-flow-files, which consumes Flow code and outputs .flow files containing only the types exported. It's alpha-level and we're still iterating on it, so use at your own peril!Notable bug fixes:
any, then the types it exported were also given type anyflow coverage had a non-termination bug. This is now fixed.Misc:
Likely to cause new Flow errors:
Likely to cause new Flow errors:
+. This may surface template strings with variables that may not safely coerce to a string.any -- but now this must be explicit. This behavior is toggleable via experimental.strict_type_args=false, but this config option will be removed in a near-term future release. There is also a codemod to help you automatically update old code.New Features:
declare export within declare module bodies. When declare export is used, the module being declared is inferred as an ES module. This enables the ability to export both named and default exports using declare module.Notable bug fixes:
Misc:
@flow in all comments at the top of the file (rather than just the first). It's also possible to configure this using a new max_header_tokens .flowconfig option.flow coverage commandRestored a bunch of deprecated/experimental/browser-specific APIs to the builtin flowlib and made them optional
(@gabelevi mistakenly listed a few v0.26.0 changes as being in v0.25.0. The Changelog has been updated to reflect reality. Sorry!)
Likely to cause new Flow errors:
New Features:
**)flow ls command to list the files that Flow can see.Notable bug fixes:
/x/* 5 */y/ - that's no comment!Misc:
Your coding agent can read these notes before it upgrades. Set up the MCP server →