Skip to content

Latest commit

 

History

History
2287 lines (1779 loc) · 120 KB

Changelog.md

File metadata and controls

2287 lines (1779 loc) · 120 KB

0.73.0

Likely to cause new Flow errors:

New Features:

  • Inline interface types (var foo: interface { x: string } = bar;). Will be particularly useful in the future when we revamp object types

Notable 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 do
  • flow type-at-pos now returns the class name for declare class declarations.

Misc:

  • Added .mjs to the list of extensions that Flow reads by default
  • Perf improvements to calculating the dependency graph during recheck. Should help recheck perf on large repositories.
  • flow find-refs --multi-hop now parallelizes the work and is much faster
  • Support using flow find-refs and flow get-def with destructuring patterns as a starting location
  • Support using flow find-refs with default (as in export default ...) as a starting location
  • Bunch of small fixes where flow find-refs would miss certain locations
  • Tweaked the location returned for flow get-def when used for default and named imports
  • Lots of libdef updates. Thanks for the PRs!

Parser:

  • Inline interface type support

0.72.0

Likely to cause new Flow errors:

  • We've made explicit the order in which imports are merged into a module during typechecking. This fixes an edge case in which lazy modes and non-lazy modes would report different errors. This may change the order in which code is typechecked, and therefore may expose errors that Flow previously missed.
  • Treat $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.
  • The $Either<T>, $All<T> and $Type<T> types are not supported any more.

New Features:

  • Find-refs now includes references to all types related to an object literal through subtyping, and a multi-hop mode was added that determines when object types are related through subtyping and links them.
  • Work towards the new object model:
    • Ensure fields overwrite methods in interface definitions (since properties there are flat).
    • Store proto fields in a separate map than the one used for own properties in classes.
    • Declare Function.prototype.bind as a proto field.
  • New/call can now be passed explicit type arguments for polymorphic instantiation. Currently this is supported by the Flow parser. Babylon support does not exist, but it is planned.
  • Made * a deprecated type, under the deprecated-type strict flag.
  • Added support for hover, completion and error reporting (publishDiagnostics) to flow LSP.
  • Implemented nullish coalescing as per the TC39 proposal.
  • Added a debug flag --expand-json-output to print an extended JSON output for type-at-pos.
  • Updates in typings:
    • Added the definition for onclose to the IDBDatabase interface in lib/indexeddb.js (reference).
    • Added onmessageerror to Worker interface and fixed type of MessagePort.onmessage in lib/bom.js.
    • Added a swap64() to the Buffer type and a Buffer property in lib/node.js.
    • Added Intl objects for the built-in JS language API (ECMA-402 - Internationalization API).
    • Added tuple types to WebGL uniform**v setters in lib/dom.js.

Notable bug fixes:

  • LSP: Fixed races in reporting exit status over persistent connection and in test.
  • Fixed error reporting when accessing statics and simplified error localization.

Misc:

  • Added documentation for Object type, "Flow for Atom IDE" in Atom plugins, Flow Strict and the nonstrict-import lint rule.
  • LSP supports file edits. Each client now stores the content of files that are opened.
  • Added LSP test checking that contents of open files persist after restart.
  • Removed Travis from CIs.
  • Type normalizer: added option to flag cases where the inferred type parameter is shadowed by another parameter with the same name, and fixed support for recursive polymorphic types.
  • Removed dependency on ocp-build (windows now uses ocamlbuild).
  • Introduced a union-find/disjoint-set data structure used in find-refs to maintain sets of related types.
  • Fixed return types for WebGLRenderingContext#is* methods to all return booleans.
  • Rearranged contents of src/server directory.
  • Refactored find-refs by splitting variable and property handling in separate files, and breaking down functions based on their purpose (e.g. local vs global).
  • Made $Subtype and $Supertype "unclear" types when not in a library context.
  • type-at-pos now prints types at the client-side.
  • Minimum OCaml version is increased to 4.05.0.
  • Avoid redundant substitution by caching the result of substituting a polymorphic definition with a list of type args.

Parser:

  • Added support for nullish coalescing ?? (as above).
  • Simplified object type parsing. Dangling + or static inside an object type (e.g. {+}) are now disallowed.
  • Added support for a proto modifier in declare class, to specify that the property is a prototype property instead of a class one.
  • Internal slot properties in object types (e.g. [[new]]).
  • Explicit type arguments in new and call expressions, e.g., f<T>(x).
  • Allow reserved words as optional chain property names.

0.71.0

Likely to cause new Flow errors:

  • The result of the unary minus (negation) operator would sometimes be incorrectly generalized to number rather than a literal type. This has been fixed.
  • Further restrictions on module and exports. The disallowed patterns include computed property accesses as well as clobbering or aliasing module and/or exports.
    • These restrictions are only enabled if experimental.well_formed_exports=true is specified in .flowconfig.

New Features:

  • Fragment has been added to the default exports of the React libdef.
  • Invoking find-refs on a property key in a type declaration will now also yield that key in object literals.
  • Files can now be marked @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.
  • Type support for the Stage 1 Optional Chaining proposal. To use this feature, set esproposal.optional_chaining=enable in your .flowconfig.
    • Note: We currently disallow calls whose callees are member expressions when the call or member is part of an optional chain. This restriction will be lifted in the future when we reconcile the optional chaining implementation with our implementation of method calls.

Notable bug fixes:

  • The type normalizer now correctly tracks the scope of type parameters instead of assuming they share the scope of the type definition.
  • Test output files are cleared before running tests. This prevents old errors from being printed on subsequent failing runs when those runs do not produce errors.
  • estree_translator properly handles all cases of the DeclareClass AST node.
  • The suggest command has been fixed to work with the new type normalizer.
  • When evaluating spreads inside array literals, we determine the element type early, preventing exponential complexity and infinite loops.
  • Object spread in JSX props now preserves exactness.

Misc:

  • Various improvements to find-refs.
  • Optimizations for polymorphic subtyping.
  • Adds CircleCI for continuous integration and migrates the flow.org build from Travis to Circle.
  • New tests for LSP support (disabled by default).
  • Certain exceptions will now print backtraces in addition to the exception string.
  • Improvements to spreading in array literals.
  • Support for Flow coverage reports using codecov.io.

Parser:

  • The AST has been updated to use snake_case for record fields rather than camelCase. Some field names have also been updated.
  • Support has been added for the Numeric Separators proposal, currently Stage 3.
  • The AST representation for Optional Chaining has been updated to use new 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.

0.70.0

Likely to cause new Flow errors:

  • Existing 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.
  • Spreading an object of exact type used to result in an unsealed object type, which allowed adding new properties not mentioned in the original type. Now, the result has an exact object type, which bans adding new properties.
  • New missing annotation errors might be reported. These requirements were missed before because of implementation bugs. We now use the polarity-sensitive type visitor to walk exported types, which reports errors in the expected places. There are several exceptions, which can be exported without annotations: e.g., object and array literals; initialized class properties (instance & static); and this parameters.
  • Interactions of typeof with speculative typechecking would lead to missed errors, which will now be reported as expected.
  • Various new restrictions now ban abuses of module and exports.

API changes:

  • The output format with --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 version of ocaml-sourcemaps. The API changed slightly, but most of the changes are adding support for reading/composing sourcemaps, which we aren't using.

New Features:

  • Updated React libdefs with the new createContext and createRef APIs introduced in React 16.3.
  • Classes can now be spread (copying over their static properties).

Notable bug fixes:

  • Lazy_mode_utils.focus_and_check wasn't filtering out files properly when processing updates.
  • The monitor would keep restarting segfaulting servers.
  • Lint errors would interfere with speculative typechecking (with union / intersection types)
  • Switch to using nonblocking file descriptors with Lwt to address Flow hangs
  • Fixed a crash in the no-color error printer caused by degenerate locations.
  • Improved refinement of truthy/falsy intersections.

Misc:

  • Various improvements to type-at-pos and friends, including converting normalized types back to AST nodes for printing.
  • Various improvements to find-refs.
  • Various CI improvements as part of the move to Circle.
  • Various debugging utils.
  • Array types are now printed as Array<T> instead of T[].

Parser:

  • Exposed implements and mixins fields of the DeclareClass AST node.
  • Added tokens option to JS API: flow.parse(..., { tokens: true }) will now return the token stream, like flow ast --tokens does.
  • Added options support to the parser's C interface. This change lets you pass a map of options to the parser via the C++ API, and from JS via flow-parser-bin. You could already do this from the js_of_ocaml parser, so now their APIs match.

0.69.0

Notable bug fixes:

  • Fixed a couple bugs in pretty printing errors which could cause flow status to throw an exception

Misc:

  • Lots of internal refactoring/changes this release, so not too much to report!
  • A bunch of libdef improvements. Thanks everyone for the PRs!

0.68.0

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:

  • Improve union optimizations
  • Add type declarations for new React 16.3 lifecycle methods

Notable bug fixes:

  • Fix get-def for declare var
  • Fix type-at-pos for opaque types

Misc:

  • Remove special-casing of declare var exports, long deprecated

0.67.1

Restore accidentally-deleted Object.setPrototypeOf library definition.

0.67.0

Likely to cause new Flow errors:

  • Replace some 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/>).
  • Fix nontermination that could occur when printing types (e.g. for type-at-pos).

Misc:

  • Fix type-at-pos on method calls that have been affected by type refinements.
  • Add --profile flag to flow force-recheck.
  • Fix --retry-if-init false.
  • Improve type-at-pos location for opaque type declarations.
  • Add a message to the flow status output when the server is in lazy mode.
  • Include filename in flow ast output.
  • Add typings for ReactDOM.hydrate().
  • Make process.umask's argument optional.
  • Some miscellaneous improvements to code quality.

Parser:

  • Optional chaining parser support. This feature does not yet have type system support and should not be used.

0.66.0

New Features:

  • Error message redesign to help you better debug typing issues in your programs.
  • Upgrade global find-refs from experimental to beta.
  • Improve global find-refs performance by 2x-20x depending on the workload.
  • Support for CommonJS imports/exports with global find-refs.
  • Find usages of overridden instance methods with find-refs.
  • Improvements to type reporting services like type-at-pos and coverage thanks to a type "normalizer" rewrite. Notably, the normalizer and client services like type-at-pos now:
    • Make more aggressive use of type aliases, leading to more compact results,
    • Correctly distinguish between class types and their instance counterparts,
    • Report abstract type parameters themselves instead of their bounds, and
    • Precisely report recursive types.

Likely to cause new Flow errors:

  • Unresolved type variables internally unified with any no longer completely resolve to any. This may uncover new bugs in your programs where some inferred types silently resolved to any.
  • Fix type system "stall" for spreads of null and undefined. This meant programs like ({...null}: {p: number}); incorrectly passed Flow. If you were spreading a maybe-object type then Flow may catch some new bugs in your programs.
  • Because of the new error messages some suppression comments (configured with suppress_comment) will become unused since error locations moved.

Misc:

  • 3.5x performance improvement for some Facebook projects that makes heavy use of complicated unions of string literals such as GraphQL enums generated by Relay. (Performance improvements will scale with your usage of large string literal unions.)
  • Improve the nonstrict-import lint's error message.
  • Fix bug in React.cloneElement for stateless functional components.
  • Add --max-warnings flag which allows Flow to exit with a non-zero exit code if warnings are present.
  • Add --file-watcher flag to ignore file system events.
  • Expose url.format's urlObj argument type.

0.65.0

Likely to cause new Flow errors:

New Features:

  • 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
    }

Notable bug fixes:

  • Fixed regression in recheck performance

Misc:

  • implements now works on declare class in addition to class
  • declare module library definitions are now considered @flow strict
  • Fixed non-@flow strict import rule when in a cycle
  • Fixed incorrect spreading call properties and indexer properties from interface types
  • Fixed type-at-pos and coverage commands when they encounter Object.prototype and Function.prototype
  • Fixed a crash when hit with more than 1024 concurrent connections, by returning an error instead
  • Fixed the --timeout flag to work properly now that it connects instantly to the server monitor
  • Added an exit code (5) for when the server goes unused for a week and shuts itself down
  • Added a merge_timeout .flowconfig option to mirror the --merge-timeout CLI flag added in 0.64

Parser:

  • Fixed location of types containing trailing parens
  • Added implements to DeclareClass nodes

0.64.0

Likely to cause new Flow errors:

  • event is no longer recognized as a pre-declared global

Notable bug fixes:

  • An optimization intended to reduce redundant work during rechecks never fired after recent changes.
  • The implementation of React.ElementConfig involved a subtyping rule going the wrong way.

Performance improvements:

  • Typing info for files were retained in memory even after those files were deleted. This memory is now reclaimed.
  • Dependency calculations that occur during initialization and every recheck are now faster.

Misc:

  • Adds --merge-timeout server flag
  • Drops non-strict type args config
  • Fixes issue where flow-upgrade would not check .jsx files
  • Includes various fixes to docs

Parser:

  • Includes thin bindings to allow interfacing with the parser from C++. A prebuilt libflowparser.a is available for Mac and Linux on the GitHub release.
  • flow-parser-bin is an experimental node.js extension that provides access to the native (OCaml) parser from JS. flow-parser will be updated to delegate to flow-parser-bin if your platform supports it, and fall back on the slower compiled-to-JS implementation otherwise.
  • Trailing commas after a rest element in object patterns is now disallowed following the spec.

0.63.1

Bug fix:

  • Forgot to cherry-pick a diff to fix flow init, which was generated an invalid .flowconfig

0.63.0

Likely to cause new Flow errors:

  • Strict mode now treats function parameters as const
  • Declaring the exported type of a CommonJS module via declare var exports: T is deprecated in favor of declare module.exports: T

Notable bug fixes:

  • If a single file (or cycle of files) takes more than 100s to merge (which indicates something is horribly wrong), Flow will emit an error, stop merging that file/cycle, and continue merging the rest of the files.
  • Better handling of internal Flow errors during merge. A file (or cycle of files) with an internal error during merge will emit the error and set the type of the exports to 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.
  • The first steps in a large error message revamp are included in this version of Flow. Larger changes will follow in later versions.
  • Some small perf improvements
  • A bunch of libdef improvements. Thanks everyone for the PRs!

Parser:

  • Enforce that the rest property in object destructuring must be last.
  • Fixed a bug which banned methods named static in object types

0.62.0

Likely to cause new Flow errors:

  • Removed support for static properties on interfaces. Static properties were never well supported, and in most cases their types were not actually checked.
  • Fixed the polarity checker, which was not erroring in many places where it should have, like class statics.
  • Removed 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:

  • Improved error message locations and context around type errors in many cases
  • Added flow cycle subcommand, which prints a .dot describing the cycle for a given file.

Notable bug fixes:

  • Fixed bug where [lib] files outside the Flow root would not be watched for changes
  • Fixed a few race conditions, which would mask errors depending on the order of imports in a file.
  • Fixed refinements on opaque types with declared bounds.

Misc:

  • Added nonstrict-import lint rule, which requires that strict files can only depend on other strict files.
  • Added unsafe-getters-setters lint rule, which replaces the unsafe.enable_getters_and_setters flowconfig option.

Parser:

  • Added missing method property to object type property AST node.
  • Added support for properties named static for declare class and interfaces.
  • Changed to separate Variance AST node for +/- annotations, matching Babylon.
  • Improved performance by reducing GC pressure.

0.61.0

New Features:

  • 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 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.
  • Experimental: Global find-references for class members.

Notable bug fixes:

  • Fixed an issue that caused IDE commands (autocomplete, get-def, etc.) to crash in certain cases.
  • Fixed an issue that caused IDE commands to return no results when the this type is nullable.
  • Fixed several bugs in lazy mode to avoid crashes and missed errors.

Misc:

  • Issue an error at every location where a particular non-existent module is imported, instead of just the first one in each file.
  • For the get-imports command, show every location where a module is imported instead of just one per file.
  • Quite a few libdef improvements.

Parser:

  • Disallow literals as prop keys in assignment destructuring.

0.60.1

Fixed a bug introduced in 0.60.0 in which Flow would not start if its temp directory did not exist.

0.60.0

Likely to cause new Flow errors:

These changes do not introduce new errors, but error suppressions may need to be moved to the new, more accurate locations.

  • Improved positioning of errors involving object types with incompatible indexers.
  • Improved positioning of errors involving the arguments of overloaded function types.

New Features:

  • 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.

Notable bug fixes:

  • 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!

Misc:

  • Fixed compilation under ocaml 4.06
  • Added dependency on lwt from opam
  • Fixed error behavior of flow coverage in --quiet and --json modes
  • Made --json consistently imply --quiet in all commands, notably status
  • Fixed an issue where a new server may end up writing to the .log.old file
  • Various additions to lib definitions, thanks for your contributions!

Parser:

  • Implemented JSX spread children syntax
  • Made missing commas in export specifiers a parse error
  • Made import type * a parse error

0.59.0

New Features:

type O = { a: number, b: string };

function fn(o: $ReadOnly<O>) {
  o.a = 42; // Error!
}
  • Allow read-only property initialization in constructors. Covariant properties are still read-only everywhere else in the class.
class X {
  +p: number;
  constructor(p: number) {
    this.p = p;
  }
}

Notable bug fixes:

  • Improves positioning for error messages involving exact objects. Notably, this bug caused error messages against React.Element to incorrectly point at library definitions instead of user code.

Misc:

  • Experimental implementation of find-all-references.
  • Enforces that exported class statics are annotated.
  • Improves typings for Node.js HTTP server listen() function.
  • Removes redundant information from some React error messages.

Parser:

  • Adds parser support for JSX fragments.
  • Various correctness changes to which identifiers error on reserved value and type names.
  • declare class with multiple extends is now a parse error.

0.58.0

Likely to cause new Flow errors:

  • Detect match failures with disjoint unions. Example:
    type Foo = { type: 'A', ... } | { type: 'B', ... }`
    function match(foo: Foo) {
      switch (foo.type) {
        case 'C': ... // dead branch, now error! (was allowed previously)
        ...
      }
    }
    

New Features:

  • Support for user-defined "strict" mode. Using @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:

  • Error location improvements for a bunch of common operations

Parser:

  • Tighten the AST around import statements, and rewrite their parsing logic
  • Improvements to locations of import statements, export statements, and declare statements

Perf:

  • Optimize a hot path in lazy mode, speeding up IDE commands
  • Optimize calculation of dependents, speeding up rechecks
  • Fix exponential blowup for large enums

Reliability:

  • Fix deadlock issues with flow ide
  • Gracefully handle crashes of the file watcher

Misc:

  • Don't list ignored files with flow ls
  • Remove flaky support for $Tainted types
  • Remove flaky support for --raw type printing
  • Various additions to lib definitions, thanks for your contributions!

0.57.3

Notable bug fixes:

  • Fixed a race condition which was causing the Flow server to hang during merge
  • Rebuilt the Windows binary

0.57.2

Misc:

  • Reverted the change which stopped call properties from flowing to object type dictionaries

0.57.1

Notable bug fixes:

  • Fixed a crash when a file goes from parsable to unparsable
  • Fixed a server crash when a client dies before receiving a response

Misc:

  • Added logging to show which components take a long time to merge

0.57.0

Likely to cause new Flow errors:

  • We've manually enumerated all the JSX intrinsics, so Flow might notice if you're misusing an intrinsic.
  • $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 x

New Features:

  • Flow will now only check the files in node_modules/ which are direct or transitive dependencies of the non-node_modules code.

Notable bug fixes:

  • A handful of fixes for flow ide on Windows
  • Fixed a few bugs that would cause flow server to crash when flow ide exits
  • Fixed a regression in v0.56.0 which caused Flow to crash on import type * syntax
  • Fixed $ObjMap's behavior on optional properties
  • Various fixes for type destructors (like $PropertyType, $Diff, and $ObjMap)
  • Object type indexers no longer include call properties. So {[string]: boolean} is no longer a subtype of {(number): string}.
  • Fixed a bug where circular type imports would miss errors involving union types in rare cases.

Misc:

  • Updated Flow headers and license file from BSD3 to MIT
  • flow server will now write to a log file in addition to stderr
  • flow ls will now list the .flowconfig
  • flow ls will now list lib files, even if --all is not set
  • flow ls --imaginary will list nonexistent files. It's useful for speculating whether or not Flow would care about a file if it existed.
  • Added flow force-recheck --focus which tells a lazy server to start caring about certain files
  • Various small error message fixes
  • Lots of libdef updates! Thanks everyone for the contributions!

0.56.0

New Features:

  • Added a $Rest<A,B> type, which models the semantics of object rest
  • Added support for null prototypes, a la Object.create(null)
  • Added support __proto__ property in object literals and object type annotations

Notable bug fixes:

  • Improved support for React higher-order components, e.g. Relay fragment containers
  • Improved performance of flow focus-check for multiple files
  • Fixed type-at-post support for $ReadOnlyArray types
  • Fixed many cases where error messages were reported far away from the root cause.
  • Fixed find-refs for named exports

Misc:

  • Added experimental lazy mode for IDEs
  • Added <VERSION> token for suppress_comment option in .flowconfig
  • Removed support for $Abstract utility type
  • Removed support for flow typecheck-contents --graphml

0.55.0

Likely to cause new Flow errors:

  • Fixed a bug that caused unsoundness with $ObjMap.

New Features:

  • Flow is now capable of servicing some requests while it is rechecking. This should improve the IDE experience on large codebases.
  • Added $Call utility type.
  • Added $Compose and $ComposeReverse utility types.
  • Added support for spreading mixed into an object type.

Notable bug fixes:

  • Improve results from the find-refs command.
  • Allow null and undefined as React.createElement() config (fixes #4658).

Misc:

  • Miscellaneous code cleanup.
  • Located error messages related to functions at only the signature, rather than the entire range of the function body.
  • Improved error messages when this types are incompatible.
  • Properly check subtype relationships between callable objects.
  • Fixed a bug that caused mixed not to be properly printed from type-at-pos.
  • Improved error messages regarding incompatible Array type parameters.
  • Preserve some inference information across module boundaries.
  • Support assignments to shorthand method properties in object literals.

Typedefs:

  • Added captureStream() to HTMLCanvasElement and HTMLMediaElement.
  • Added HTMLOptGroupElement return type for document.createElement().
  • Added Recoverable and context to the repl module.
  • Fixed return type for AudioContext.createMediaStreamDestination().

Parser:

  • Various fixes to improve test262 compliance:
    • Correctly disallowed various illegal constructs in destructuring patterns.
    • Allow destructuring in catch.
    • Added \u2028 and \u2029 to the list of line terminators.
    • Allow unicode escape codes in identifiers.
  • Improved parse errors when using private properties outside of classes.
  • Disallowed reserved words as function param names in types (e.g. (switch: number) => void).

0.54.1

Notable bug fixes:

  • Fixed an issue where the server becomes temporarily unresponsive after a recheck and the client consumes all its retries.

0.54.0

Likely to cause new Flow errors:

  • Extending a polymorphic class must now explicitly specify the parent class's type args. That is, 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.
  • Improved accuracy of type checking calls of built-in methods (e.g. Object, Array, Promise)

Notable Changes:

  • Implemented private class fields, part of the Class Fields proposal.
  • Implemented "phantom" types (e.g. 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)
  • Unused suppression errors are now warnings instead
  • Improved errors involving polymorphic types, so that they now point to the source of the conflict, rather than the nested type args that are incompatible. This was a major source of errors in files other than where the problem was.
  • Improved errors involving structural subtyping, so that they now reference the objects that are incompatible in addition to the incompatible properties
  • Improved errors when an inexact object type flows into an exact type
  • Made rest parameters in object destructuring patterns sealed, and exact if possible
  • Improved definitions for some node fs functions
  • Improved performance by removing unnecessary caching

Misc:

  • Improved accuracy of type checking of React children in React.createClass
  • Fixed a bug related to instantiating a polymorphic type (e.g. type t = T<U>) with empty type args (e.g. var x: T<>)
  • Fixed polarity checking for property maps
  • Fixed a bug where polymorphic types were incorrectly checked for equality
  • Improved React definitions
  • Added a FLOW_TEMP_DIR env, equivalent to passing --temp-dir
  • Added a minimal libdef that defines the few things Flow can't run without, even when using no_flowlibs=true

Parser:

  • Added flow ast --strict to parse in strict mode without "use strict"
  • Added support for the RegExp dotAll ('s' flag) proposal
  • Added support for the private class fields proposal
  • Added support for destructuring defaults in assignments (e.g. given ({ x = 1 } = {}), x is 1)
  • Fixed issues related to let, yield, await, async, super and other reserved words
  • Fixed issues related to declarations in statement positions
  • Fixed issues related to destructuring patterns
  • Fixed issues related to IdentifierReferences, like shorthand object notation
  • Fixed issues related to class parsing, particularly new.target and async methods

0.53.1

Fixed a bug that sometimes crashed the server during recheck

0.53.0

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) often with the React element type (Array<React.Element>). However, using arrays is problematic because React children are not always an array. To fix this, now use the new React.ChildrenArray type.

New Features:

  • Modeling advanced React patterns, like higher-order components, is difficult today because the types you would need are either not provided or undocumented. In this release we added a whole suite of utility types which are all documented on our website.

Notable bug fixes:

  • Flow used to have a bug where Flow would consider the following code as valid:
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:

  • We fixed miscellaneous character encoding issues.

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!

0.52.0

New Features:

  • Flowlint - a linter built into Flow that you can configure to complain about things which aren't quite type errors.

Notable bug fixes:

  • Flow now enforces polarity on class supers (e.g. Flow will error on class B<+T> extends A<T> {} when A's type parameter is not covariant)

0.51.1

  • Changed linter (experimental, coming soon) to ignore lint errors in node_modules

0.51.0

New Features:

  • Added support for opaque type aliases
  • Added library definitions for the Node.js repl module (thanks @zacharygolba!)

Notable bug fixes:

  • Fixed library definitions for the Node.js cluster module (thanks @Corei13!)
  • Fixed the return type of EventEmitter#setMaxListeners (thanks @ahutchings!)
  • Added missing properties in the Node.js fs module (thanks @ahutchings and @rgbkrk!)
  • Fixed the length property on $ReadOnlyArray to be covariant (thanks @popham!)

Misc:

  • Improved error handling in our test runner
  • Fixed type error in our docs (thanks @stenehall!)
  • Fixed broken link in docs (thanks @vasyan!)
  • Fixed misleading typo in docs (thanks @joelochlann!)

Parser:

  • Fixed end locations of various statement nodes to include terminal rparen
  • Added separate DeclareTypeAlias and DeclareInterface AST nodes, matching Babel
  • Fixed locations of declared vars, classes, and functions in declare export stmts

0.50.0

Likely to cause new Flow errors:

  • Fixed a bug that suppressed unrelated errors when a missing annotation error was also suppressed.

New Features:

  • Added $Values type.

Notable bug fixes:

  • Fixed lints appearing in Try Flow.
  • Miscellaneous libdef improvements.
  • Fixed a couple bugs that could lead to missing push diagnostics when using the persistent connection.
  • Made $ReadOnlyArray covariant in variance checking.

0.49.1

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.

0.49.0

Notable bug fixes:

  • Optimized performance when typechecking classes
  • Optimized performance of sentinel property checks involving large enums
  • Lots of libdef updates! Thanks everyone for the contributions!

Misc:

  • Fixed infinite recursion from array spread
  • Added experimental support for sending errors to an IDE over a persistent connection
  • Removed unused --libs flag on status, check, and start commands

Parser:

  • Fixed parsing scientific notation with decimal but no fractional part
  • Added support for parsing opaque types. Type system support coming soon.

0.48.0

New Features:

  • Experimental support for "lazy" typechecking. On large codebases, the Flow server will start up faster when using the --lazy flag with flow start or flow server, by only computing dependency information and not doing any typechecking. Instead, as files are touched, they are typechecked incrementally along with files that depend on them (and their dependencies). Relatedly, running flow focus-check on a file will only check that file and files that depend on it (and their dependencies).

Notable bug fixes:

  • Fixed crash in flow.org/try when using JSX (which was a regression in 0.46)

Misc:

  • Libdef updates! Thanks everyone for the contributions!
  • Removed the libelf dependency from Flow. This helps a few systems, like the standard node docker, that doesn't have libelf available.
  • Removed the strip_root .flowconfig option, since it doesn't make sense as a project-specific option and complicated IDE integration. Clients (including IDEs) can still use the --strip-root CLI flag as needed.
  • Improvements to handling of Object.prototype
  • Improvements to handling promotion of primitives to objects
  • Lots of refactoring to improve stability of commands and the typechecker

0.47.0

Likely to cause new Flow errors:

  • We are now sealing the object type that is passed to a React component's props. This means Flow will start complaining if you try and access unknown React props.
  • Strict function call arity checking is now on for everyone! The 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:

  • There are a bunch of flow commands that will quickly try to check a single file, like autocomplete, get-def, check-contents, etc. We're trying to clean up what happens when these commands are given a file with @flow, @noflow, or no pragma. v0.47.0 contains a change intended to avoid doing extra work for files with @noflow or no pragma at all. v0.48.0 should continue to address this.

Misc:

  • Libdef updates! Thanks everyone for the contributions!
  • In a bunch of situations we're now propagating any types and continuing typechecking rather than stopping altogether.
  • Using a function as an object will now give that object a call property

Parser:

  • Optimized parsing of huge list of nested ternary expressions
  • The JS version of the parser now throws proper JS errors in the rare case that an OCaml exception is uncaught

0.46.0

Likely to cause new Flow errors:

  • We updated the type for the 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.
  • We fixed the type of Promise.prototype.catch, which means code that uses .catch but wasn't properly handling the exceptional behavior might now have Flow errors

New Features:

  • We're updating how get-def (the jump to definition feature) works. It will now jump straight to the definition, even if it's in another file, rather than to the most recent assignment.
  • Starting in v0.47.0 we're going to complain when you call a function with more arguments than it expects. You can try it out in v0.46.0 with the .flowconfig option experimental.strict_call_arity=true. For more check out this blog post

Notable bug fixes:

  • Fixed a exponential blowup that could happen when using functions as callable objects
  • Fixed a bug where calling a function with a rest param wouldn't flow undefined to unfulfilled parameters.
  • Fixed a bug where declare class classes would be given a default constructor even if they extended another class

Misc:

  • Flow is faster! There are a bunch of perf wins in this release!
  • Lots of updates to library definitions! Thanks to all our contributors!
  • When using the Flow CLI, multiline errors will now show multiple lines of context
  • Replaced --no-suppressions with --include-suppressed which is a little bit more well-behaved.
  • Added --pretty flag to flow check for pretty-printed JSON

Parser:

  • Import expressions that appear in a statement list are now correctly parsed as import expressions (thanks @mikaelbr!)
  • Fixed the location of declare function declarations with predicates
  • Fixed the location of yield expressions with semicolons
  • Fixed the location of declare module declarations
  • Fixed a bug where array pattern with defaults like [a=1, b] = c was parsed like [a=(1, b)] = c.

0.45.0

New Features:

  • Flow now has proper unicode support in its parser!
  • Support for import expressions (Thanks deecewan!)
  • Introducing export type * from ..., an analogue of export * from ...

Notable bug fixes:

  • Fixed incremental checking bug when lib files are added or removed

Misc:

  • libdef and docs updates. Thanks for the PRs! Keep 'em coming!

Parser:

  • Unicode is finally supported! We've moved our lexer from ocamllex to sedlex, which supports unicode!
  • Fixed location of unary operator argument when surrounded by parens
  • Fixed a bug around using tagged templates expressions as call or member expressions

v0.44.1

Notable bug fixes:

  • Fixed the definition for HTMLBRElement, which extended itself :(

v0.44.0

New Features:

  • Another big perf win!

Notable bug fixes:

  • 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 was missing before

Misc:

  • Lots of libdef and docs PRs merged! Thanks to everyone for the help!
  • Minimum OCaml version is now 4.02
  • Partial support for object type spreads with generics

v0.43.1

Features:

  • Big perf improvement!

v0.43.0

Parser:

  • Fixed parser to disallow variance sigil for when using object spread.
  • Cleaned the flow-parser npm package of cruft. Thanks @zertosh!

Notable bug fixes:

  • Some internal refactoring helps Flow find some errors that it was previously missing.

Misc:

  • A ton of libdefs updates and documentation fixes. Thanks for all the PRs!

v0.42.0

Likely to cause new Flow errors:

New Features:

  • Object type spread (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.
  • Experimental new 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:

  • Fixed a bug that would cause Flow's recheck to never terminate

Parser:

  • Support for object type spreads.

Misc:

  • Lots of updates to the builtin flow libs! Many thanks to all our contributors!
  • Object types with dictionaries are now considered sealed (you cannot add new properties to them). This is a minor change, since you can still write to the dictionary.
  • We've relaxed the restriction that React.PropTypes.oneOf must take an array of literals. You can now put non-literal values in the array.

v0.41.0

Notable bug fixes:

  • Lots of improvements to typing React components (which may uncover previously missed errors). This release primarily focused on these tweaks to React typing
  • Previously Flow did not track much about mixins from React.createClass components (including mixed in proptypes). This has been fix and may uncover new proptypes errors in createClass components
  • The internal React libdef for findDOMNode has been updated to include null in its return-type now (since this function can, indeed, return null)

Misc:

  • flow get-importers has been removed. It was rarely used and added an incredible amount of complexity to the codebase
  • Lots of updates to builtin flow libs

v0.40.0

Notable bug fixes:

  • Fixed an edge case when moving .flow files around in a haste project
  • Fixed bug which allowed you to add extra properties to exact objects
  • Fixed pretty printing of methods in type-at-pos and gen-flow-files
  • Fixed the @jsx pragma support's handling of trimming whitespace and filtering empty children. It now matches the behavior of the babel transform
  • Fixed some merge_strict_job exceptions
  • Fixed bug where Flow would ask for annotations in the object passed to React.createClass() even when they were not needed.
  • Fix so now you can use this and super in class method parameter defaults.
  • Optimization around union types

Parser:

  • Fixed a bug where line comments in certain positions were parsed as block comments

Misc:

  • Lots of updates to the builtin flow libs! Many thanks to all our contributors!
  • Some tweaks to error messages to make them easier to understand.
  • We are NOT removing weak mode in this release. See the discussion on #3316

v0.39.0

Likely to cause new Flow errors:

  • Previous usage of ReactElement<*> as a return type for render functions in React may now cause new errors now that a type propagation bug has been fixed. The general solution for this is to remove the return type for functions that return a React element (return types can be inferred by Flow, and Flow has never had a good way to express the type of a specific React element)
  • Several significant improvements to the locations Flow points to in error messages about objects and property accesses may move errors that were previously suppressed with a suppression comment to a new location

New Features:

  • You can now pass --no-suppressions to flow check in order to see what errors would show up in your codebase if you deleted all the error suppressions
  • New advanced debugging feature: You can now use the special $Flow$DebugPrint type to make Flow print a JSON representation of a type. Example usage: declare var flowDebug: $Flow$DebugPrint; flowDebug(someVariable);
  • Flow now supports constant-folding of tuple types. In general this means that Flow can now better understand rest elements and array-spreads when tuples are involved.
  • Flow now supports spreading types that are iterable (other than just Arrays)

Notable bug fixes:

Parser:

Misc:

  • A few improvements to error messages relating to React PropTypes
  • Various core libdef updates

v0.38.0

Likely to cause new Flow errors:

  • There are some error-position improvements in this release. This means that if you use // $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.
  • The behavior for tuples has changed to strictly enforce arity. This might cause errors depending on how you use tuples.

New Features:

  • implements - classes can now implement one or more interfaces and Flow will verify that the class properly implements the interfaces.
  • Local find references command: 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.
  • New shorthand for importing types in the same declaration that imports values: import {someValue, type someType, typeof someOtherValue} from 'foo'
  • Autocomplete now works with exact object types (thanks @vkurchatkin!)
  • Tuple types have been revamped. They now strictly enforce arity (docs). This will enable a bunch of future features around spreads and rest parameters. Stay tuned!
  • $ReadOnlyArray<T> is the common supertype of arrays and tuples. It's basically an array without stuff like push(), pop(), etc
  • A lot of tweaks to error messages to make them easier to understand.
  • You can declare getters/setters in declare class, interface's, object types, etc. They're still not safely checked, though.
  • Set emoji=true in the .flowconfig options and flow status will put emoji in the connection status messages (thanks @zertosh!)

Notable bug fixes:

  • You can now use template strings with require(), (e.g. require(`foo`))
  • Object.keys no longer returns methods since they are not enumerable
  • We've relaxed sentinel checks to allow you to check unknown properties. This is consistent with other conditionals
  • Flow recognizes type mismatches between the LHS and RHS of a sentinel check as always failing
  • Flow recognizes null and undefined checks as sentinel checks too
  • Flow used to assume that an array literal with a single element of type T had the type Array<T>. Now it's Array<*>, which lets you add elements of other types to the array.
  • Fixed $Shape to ignore "shadow properties", which are properties that don't really exist, but which have been referenced somewhere.
  • A few recheck bug fixes. The optimization from 0.37.0 wasn't properly rechecking when property variance changed, when certain locations changed, or when certain files are renamed.
  • Fixed mistake where computed getters and setters weren't erroring with unsafe.enable_getters_and_setters=false

Misc:

  • Lots of updates to the builtin flow libs! Many thanks to all our contributors!
  • make no longer complains if js_of_ocaml is not installed
  • flow check --profile now includes CPU time
  • flow server --profile and flow start --profile now print profiling info to the logs
  • Some optimizations for huge dependency cycles.
  • tests/ which run a flow server now save the .log file when they fail
  • Many tests now run with --no-flowlib, which make them much faster

Parser:

  • Parsing support for object spread properties
  • Fixed kind of a static method named constructor to be "method" rather than "constructor"
  • Support for new import type shorthand
  • OCaml AST for getters and setters is a little cleaner now
  • We now support defaults in setters
  • The bug fix for trailing commas in array lists was accidentally reverted and has been re-committed.

v0.37.4

Notable bug fixes:

  • 1 more server recheck fix... Fourth time's a charm!

v0.37.3

Notable bug fixes:

  • 1 more server recheck fix... Third time's a charm!

v0.37.2

Notable bug fixes:

  • Fix more issues in the server with rechecking changed files

v0.37.1

Notable bug fixes:

  • Fixed an issue in /try where Flow was using an ocaml regex API that couldn't compile to JS
  • Fixed an issue where a changed "literal" type in a module signature wouldn't cause the Flow server to recheck
  • Fixed an issue where an update of a module in a cycle may not properly recheck all of its dependencies in the Flow server

v0.37.0

Likely to cause new Flow errors:

  • There are some error-position improvements in this release, which means that if you use // $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:

  • LOTS of built-in libdef updates.
  • It's now possible to use import type/import typeof inside the body of a declare module to import types between libdefs.

Notable bug fixes:

  • Fixed an issue where dictionary types couldn't flow into a covariant-compatible version of themselves.
  • Fixed an issue where previously any + number would yield number. Now it correctly yields any.
  • Don't try to read from the filesystem at all when using flow check-contents where input is provided via stdin.

Misc:

  • The --old-output-format CLI flag is now gone.
  • Performance optimization that allows us to skip re-checking any recursive dependencies of a changed file when the file's types haven't changed
  • Improved error positions on property assignment type errors.
  • The 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.
  • Things typed as "callable objects" now inherit from Function.prototype rather than Object.prototype.

v0.36.0

Likely to cause new Flow errors:

  • We've been working on improving error messages, which often involves moving the errors closer to where the error is likely triggered. If you use error suppressing comments, some of your comments now appear unused, since the error moved.

New Features:

  • Lots of small improvements to error messages
  • flow ls --all will output libs and ignored files too
  • flow ls --explain will explain why Flow cares or doesn't care about a file
  • flow ls dirA/ dirB file.js will only list files under dirA/, files under dirB/, and file.js

Notable bug fixes:

  • Calling a method through computed properties (obj['method']()) is now supported
  • The client no longer consumes retries and waits patiently when the server is busy garbage collecting
  • Errors in lib files with --strip-root set now show context again

Misc:

  • Currently 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.
  • Better error messages for unsupported destructuring.
  • Builtin libdef improvements
  • Fixed a TDZ issue which would allow let x = x;

Parser:

  • Fixed a bug where [...rest, 123] was incorrectly parsed

v0.35.0

Likely to cause new Flow errors:

  • Flow now knows that calling 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:

  • Better error messages in a bunch of situations
  • flowtype.org/try now has an AST tab that shows the parsed AST of the example

Notable bug fixes:

  • Bindings that come from imports are now treated as const
  • Found and fixed a few situations where Flow was emitting redundant errors
  • Some if statement refinements were sticking around after the if statement in some situations when they should not have.

Misc:

  • Various libdef fixes and improvements
  • Various docs fixes and improvements
  • If foo has the typed mixed, we now allow foo.bar if you check that foo is not null or undefined.

Parser:

  • Better error message if you try to make a class property optional (currently unsupported)
  • Dropped support for let statements, which never made it into the spec (thanks @andreypopp)

v0.34.0

Likely to cause new Flow errors:

  • Dictionary types (i.e. {[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.
  • Object property types are now invariant by default. New syntax allows explicit opt-in to enforced covariance: type T = {+covariantProp: string}. Please see this blog post for more information on variance.
  • Object method types are now covariant by default. So this: type T = {covariantMethod(): string} is the same as type T = {+covariantMethod: () => string}. Please see this blog post for more information on variance.

New features:

  • New 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).
  • All server commands now have a --quiet flag to suppress server-status information that would otherwise be printed to stderr.
  • It's now possible to specify an "@jsx" pragma to override the implicit default of React.createElement. See the commit message for more details.
  • async iteration is now Stage 3, so Flow now supports async generators and for-await-of statements.

Notable bug fixes:

  • Calling 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.
  • Fixed an issue with inferring the proper return-type of iterators coming from a generator with multiple return-types. See #2475 for more details.
  • Fixed an issue where a non-polymorphic class-instance used as a CommonJS export wasn't omitting underscore-prefixed members when the munge_underscores config option is set to true.
  • Fixed an issue where Flow would previously not consider non-@flow files when re-calculating type dependencies on a change to the filesystem. This caused sporadic issues where Flow might think that a module is missing that actually is not! This is now fixed.

Misc:

  • Significant memory usage optimizations by normalizing common aspects of the many "reason" structures stored in memory to use ocaml variants.
  • Significant memory usage optimization by compressing the contents of the shared heap used by the persistent server.
  • Parser now allows for duplicate properties and accessors in objects per the latest ES spec.
  • Flow parser is now tested against esprima3 tests
  • 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.
  • Various core libdef updates.

Parser breaking changes:

  • Updated the parser to use the latest 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.
  • Updated ExportSpecifier property names from id -> local and name -> exported per the latest ESTree spec.
  • Update ExportBatchSpecifier to a ExportNamespaceSpecifier node per the latest ESTree spec.
  • Renamed SpreadElementPattern -> RestElement per the latest ESTree spec.
  • Node-properties of ObjectPattern are now named Property and RestProperty per the latest ESTree spec.
  • Use a 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.
  • The mixed type annotation is now represented with a special MixedTypeAnnotation node (same as Babylon has been for a while).
  • The NullTypeAnnotation annotation node is now called NullLiteralTypeAnnotation in order to match Babylon.

v0.33.0

Likely to cause new Flow errors:

  • Its now an error to add mixed to number

New features:

  • suppress_comment now defaults to matching // $FlowFixMe if there are no suppress_comments listed in a .flowconfig
  • The Flow server no longer restarts itself when a package.json file is changed
  • The Flow server no longer restarts itself if a libdef file is touched, but not actually changed
  • Added support for using Iterables with Promise.all() (thanks @vkurchatkin!)

Notable bug fixes:

  • Fixed an issue where some predicates could cause Flow to crash
  • Fixed an issue where we weren't properly looking things up on Function.prototype and Object.prototype
  • Fixed an issue where Flow could crash when extracting coverage on empty types
  • Fixed an issue where long paths that are ignored could give a bunch of warnings on Windows
  • Fixed an issue where flow get-def wouldn't hop to the location of a type coming through an import type
  • Fixed an issue with dictionary types where using an any-typed variable as a computed-property lookup results in the wrong property-value type
  • Fixed some issues where Flow wouldn't allow definition of properties or methods called "static" on classes
  • Fixed an issue where Flow wouldn't permit throws at the toplevel of a module
  • Fixed an issue where adding a file to [libs] with an extension not listed in module.file_exts, it would previously be silently ignored
  • Fixed an issue where import * as on a declare module.exports: any; libdef would not result in a module with every possible named export
  • Fixed a parsing issue where "JSX attributes must only be assigned a non-empty expression" syntax errors sometimes point to the wrong line
  • Fixed parsing of setter methods with destructured parameters
  • Fixed a parsing issue where it wasn't possible to use get or set in object short notation
  • Fixed a parsing issue where we previously weren't allowing strings in async method names: x = { async 123() { await y; } }
  • Fixed an issue where the parser previously wouldn't recognize the u regex flag

Misc:

  • Various built-in libdef improvements
  • Various significant shared memory optimizations
  • When a package.json key is read by Flow during module resolution, don't wrap it in quotes
  • Added parser (but not yet typechecker) support for new.target
  • Added --pretty flag to all commands that have a --json flag
  • Flow now prints an exception instead of segfaulting if there is a heap overflow
  • Only print JSON for flow coverage when --json is passed (thanks @aackerman!)

Parser breaking changes:

  • Removed 'lexical' property from SwitchStatement
  • Removed guardedHandlers from TryStatement
  • Use AssignmentPattern for function param defaults to match ESTree
  • Use RestElement for function rest params to match ESTree
  • Fixed the location info for ExpressionStatement
  • Fixed the location info for CallExpression and MemberExpression

v0.32.1

Notable bug fixes:

  • If Flow runs out of heap space, it now throws an exception instead of segfaulting.

v0.32.0

Likely to cause new Flow errors:

  • If you check that an object 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)
  • We've fixed the type of Array.prototype.find to reflect the fact that it can return undefined
  • We've tightened up the checking of tuple types

New Features:

  • New syntax for exact object types: use {| and |} instead of { and }. Where {x: string} contains at least the property x, {| x: string |} contains ONLY the property x.
  • Flow now watches for .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.
  • We're starting work on 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:

  • Fixed a bug where, if a module has a CommonJS export of type any, then the types it exported were also given type any
  • v0.31.0 contained a regression where arrays and promises required more annotations than they should. This is fixed.
  • Fixed use of tagged unions with intersections and generics.
  • Jump to definition for overridden methods was jumping to the wrong method. This is now fixed.
  • flow coverage had a non-termination bug. This is now fixed.

Misc:

  • Lots of improvements to the builtin libdefs! Thanks for all the pull requests!

v0.31.0

Likely to cause new Flow errors:

  • Fixed an issue where an any type could actually prevent errors from showing up in places that actually should surface errors
  • Array.isArray() now refines arrays to Array<mixed> instead of Array<any>

New Features:

  • When the munge_underscores option is set, Flow no longer requires annotations on exported classes with munged methods. (thanks @pvolok!)
  • Added a new "magic" type called $PropertyType<T, 'x'>. This utility extracts the type of the property 'x' off of the type T.
  • It is now possible to use leading-| and & on any type annotation, not just in type aliases

Notable bug fixes:

  • Significant perf improvements on checking disjoint unions
  • Fixed an issue where flow start would sometimes hang on Windows
  • Fixed an issue where flow get-def on a react element would always point to the internal react libdef (rather than the component that defines the element)
  • Error messages for builtin types are now more descriptive in more scenarios
  • Fixed the order in which destructured function params were processed. This previously caused issues with variable references within the destructuring
  • Error messages for union type errors now point to more helpful locations in some cases
  • Fixed a long-standing confusing error message blaming property accesses on the "global object" (when the global object isn't actually involved at all)
  • Improved error message when trying to import a named export from a module that only has a default export
  • Fixed an issue where Promise.resolve(undefined) would not always error as it should
  • Fixed an issue where async functions that return void do not properly enforce their return type
  • Fixed an issue where aliased object types may not error when an invalid property is accessed on them
  • Fix flow coverage when reporting coverage on empty files
  • Printed types in some circumstances (autocomplete, type-at-pos, etc) are now capped on size to prevent overflows in tools that consume them. When the size overflows the cap, ... will be printed as an overflow placeholder
  • Various built-in libdef updates

v0.30.0

Likely to cause new Flow errors:

  • Fixed React.PureComponent's definition, so previously missed errors are now reported
  • The definition of console in the build-in libdef has been filled out and is no longer any.

New Features:

  • From now on we're going to start publishing Windows builds with each release. Please report any issues you have!
  • Forward references in type annotations: you can now reference a class in a type annotation before the class is declared
  • T is now covariant in Class<T>. So if class B extends class A, then Class<B> is now a subtype of Class<A>
  • Flow now lets you destructure objects with computed keys.
  • flow check-contents --respect-pragma - check-contents checks whatever you give it, regardless of @flow or @noflow. This option changes the behavior to respect the pragma.
  • flow check-contents will now report parsing errors too (thanks @nmote!)

Notable bug fixes:

  • Fixed --trace behavior when we unify types
  • Fixed situation where the client could spin-wait for the server
  • Fixed non-termination triggered by certain calls to Function.prototype.{apply,call}
  • Fixed issue where "Duplicate module provider" errors would stick around even after being fixed.
  • (Windows) Fixed how the flow client tails the flow server's logs
  • (Windows) Fixed the log rotating
  • (Windows) Fixed issues where Flow would report Process Handles instead of Process IDs, leading to bad messages and a non-functional flow stop
  • (Windows) Fixed build outside of a git or hg repository
  • (Windows) Better error messages when you have paths that are too long

Misc:

  • undefined is now just a global variable declared in the libdefs
  • Various built-in libdef improvements
  • Nifty PR from @nmn which teaches flow that nullableArr.filter(Boolean) is non-nullable

v0.29.0

New features:

  • Tagged unions of interfaces should now work in the same way that tagged unions of type aliases work.

Notable bug fixes:

  • Building Flow outside of a git or hg repo should work now
  • If you declare an overloaded function with one overload that handles a string argument and one overload that handles a number overload, then passing in a union string | number should now work.
  • Annotations for destructured patterns now work like non-destructured patterns. Types no longer flow through these annotations, rather they are checked against the annotations and then the annotations are used instead.
  • Allow import {type} from "Foo"
  • We had a bug where Flow wouldn't complain about duplicate haste modules. This is now fixed
  • Fix for edge case hit when using experimental.strict_type_args=false and type parameter upper bounds.

Misc:

  • Various built-in libdef improvements
  • Some error location fixes
  • Lots of Windows support work. Should build and mostly work, but not fully stable yet.
  • Some performance wins
  • flow check --json --profile now includes profiling info in the JSON response

v0.28.0

Likely to cause new Flow errors:

  • Significant fix to matching members of union types. This fix very likely surfaces typechecking issues that were missed before. Check out the blog post for more details
  • Variables in template literals are now subject to the same rules as variables being concatenated with a string using +. This may surface template strings with variables that may not safely coerce to a string.
  • Type arguments are now required to be specified for type annotations that have type arguments. Previously they were implicitly filled in as 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:

  • Support for 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:

  • Fixed a bug on OSX where Flow might crash in rare circumstances
  • Fixed an issue where automatic semicolon insertion for class properties wasn't behaving properly in some circumstances.
  • It is no longer required to annotate a property on an exported class if an initializer value is present. Instead, the initializer value itself can be directly annotated. This makes annotation of class properties that are functions much less cumbersome.
  • Fixed a race-condition where Flow may not properly error when it encounters two modules with the same name (using the "haste" module system)

Misc:

  • Flow now looks for @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.
  • Various built-in libdef improvements
  • Performance improvements for the flow coverage command

v0.27.0

Notable bug fixes:

  • Fixed a filesystem race condition where Flow would note that a directory exists just before it is deleted, then try to read the directory
  • Fixed some issues with disjoint unions that have complex definitions
  • Fixed an issue where functions that come after a return aren't analyzed (even though they are hoisted)
  • A few updates to the Node.js library definitions
  • Fixed a race condition when adding specific properties to dictionary types
  • Various performance improvements
  • --strip-root is now applied to the output of --verbose
  • Fixed an issue where duplicate method declarations weren't understood correctly

v0.26.0

(@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:

  • Flow now understands stateless functional React components, which may reveal many errors if you use them heavily.

New Features:

  • Support for stateless functional React components!
  • Support for the exponentiation operator (**)
  • New flow ls command to list the files that Flow can see.

Notable bug fixes:

  • Fixed parsing of /x/* 5 */y/ - that's no comment!
  • Fixed parsing of newlines or comments at the end of a template literal.
  • Fixed an incremental bug where Flow didn't notice new JSON files in certain situations
  • Fixed a parsing service crash when a file appears and disappears suddenly.

Misc:

  • Restored a bunch of deprecated/experimental/browser-specific APIs to the builtin flowlib and made them optional
  • Fixed up parser tests and further integrated them into CI.
  • Lots of refactoring!

v0.25.0

Likely to cause new Flow errors:

  • @marudor made a tremendous effort to clean up the builtin flowlib definitions, adding missing things, fixing annotations, and removing non-standard and deprecated features. If you're relying on these things, then you may have new errors.

  • In the past, generic types could leave off the type arguments. Flow is moving towards making these required. Applying type arguments to a polymorphic type (e.g. Map<string, number>) is like calling a function. If writing my_function was the same thing as writing my_function(), it would be really difficult to pass functions as values. Similarly, by making type arguments required, it frees us up to do more with our polymorphic types. If you have a polymorphic type with default types, like type Foo<T = number>, you can now write Foo<> to apply 0 type arguments to the polymorphic type Foo.

    To ease migration, v0.25.0 still allows you to omit type arguments by default. v0.27.0 will start enforcing that type arguments are always supplied. To enable this behavior in v0.25.0, you can add experimental.strict_type_args=true to the .flowconfig.

New Features:

  • declare module.exports: type; <-- this is the new syntax to declare the CommonJS export type. Previously, you had to write declare var exports: type;. This can be used in .flow files and in declare module declarations.

Misc:

  • Now Flow builds on OCaml 4.03.0
  • Fixed up the parser tests (thanks for the help @marudor!) and have started running those in CI
  • A ton of refactoring and clean up

v0.24.2

  • Fixed a bug where Flow might run out of memory in a repository with a lot of non-flow files

v0.24.1

  • Fixed a bug where autocomplete can show internal variable names for files that use destructuring

v0.24.0

New features:

  • Many common errors now have more contextual error messages. Check out the test file changes to see what this looks like!
  • If a <PROJECT_ROOT>/flow-typed/ directory exists, Flow will now assume it is a [libs] directory by default to help reduce the amount of out-of-the-box configuration that is necessary. (Thanks @splodingsocks!)
  • Support for specifying a default on a type parameter declaration. For example: type Iterator<Yield, Return=void, Next=void> = ....

Notable bug fixes:

  • Fixed the flow coverage command.
  • Fixed crashes when running type-at-pos and dump-types over destructuring.
  • Fixed a refinement bug when evaluating a method call on a refined variable in some cases.
  • Fixed an issue where some system commands could throw if Flow attempts to read a directory that it doesn't have permission to read.
  • Fixed a bug where the inferred return type of some functions that might return void could end up as exactly void (rather than a union of the possible return types).
  • Fixed a bug where the server would crash if a .json file is deleted after a server was already running.
  • Type applications that don't have the right number of type parameters (i.e. Map<number>) now emit a more clear error.
  • Lots of dom/bom improvements sent in from contributors! (big thanks to @marudor for lots of these!)

Misc:

  • Better locations for logical operator errors
  • Better error message sorting:
    • Sorts errors in .json files by name coalesced with .js files
    • Sorts all internal errors before parse errors before type/inference errors
    • Sorts lib file errors before source file errors
  • Perf improvements for some comparisons of polymorphic types

v0.23.1

  • Fixed parsing of JSON files with duplicate object keys

v0.23.0

Likely to cause new Flow errors:

  • When you refine a mixed variable with typeof myVar === 'object', we used to refine the type of myVar to null | Object. Now it is refined to null | {[key: string]: mixed}. This means myVar.prop has the type mixed rather than any.
  • Removed non-standard Promise methods. Previous versions of Flow specified the type of Promise.prototype.done and Promise.cast, which are not standard or implemented in browsers. If you rely on a polyfill that does provide these methods, you can redeclare the Promise class in your project's local libs folder. Note that you need to copy the entire class declaration from lib/core.js in order to add methods and properties. It's not currently possible to extend the builtin declarations, but it is possible to redefine them.

New features:

  • Errors involving union or intersection types now include more information about why the various branches failed
  • flow init now has more command line flags to specify what should be in the created .flowconfig
  • flow ast now can parse JSON files
  • Comments are now supported in .flowconfig files. Lines starting with # or ; are ignored
  • In the [ignore] section of a .flowconfig you can now ignore a relative path with <PROJECT_ROOT>/path/to/ignored
  • Most flow commands have an --ignore-version flag to skip the version check specified in the .flowconfig.
  • Added a module.use_strict option to the .flowconfig. When it is true, Flow will treat every file as if it has the "use strict"; directive.
  • Using strict equality, you can now refine the number type into number literal types. (e.g. after x === 0 Flow now knows that x has the type 0)
  • Flow no longer requires return type annotations for exported functions if Flow can fully infer the type.
  • flow force-recheck FILE1 FILE2 command tells the flow server that FILE1 and FILE2 have changed and that it should recheck. This is intended for tooling that might be racing the file system notifications.
  • Flow is smarter about what !x evaluates to for various types of x.
  • <Foo /> is now allowed when Foo is a string. If $JSXIntrinsics is defined, Foo must be a subtype of $Keys<$JSXIntrinsics>
  • Support for class decorators in addition to property decorators (also gated behind the esproposal.decorators config option). Thanks @marudor!

Notable bug fixes:

  • Disallow (obj: SomeClass) except for when obj instanceof SomeClass
  • Fixed setting temp dir via the .flowconfig
  • Added missing all flag to the .flowconfig
  • Fixed a bug when destructuring a non-literal object type using a pattern with defaults
  • Fixed the --strip-root flag for displaying errors
  • Classes can now have properties named async
  • Fixed refinements like if (foo[0]) { ... }, which should work like if (foo["prop"]) { ... } does. That is, Flow should remember that foo[0] exists and is truthy.
  • Fixed parsing docblocks with CRLF line endings
  • Fixed autocomplete within if statements

Misc:

  • Added more info and structure to JSON output, without removing or existing fields
  • Loads of improvements to the builtin libraries
  • Bunch of perf improvements
  • Clarified some errors messages and error locations
  • flow start --json will start a server and output a JSON blob with info about the new server
  • Slowly improving tracking side effects in switch statements
  • Some improvements to pretty printing errors
  • Object.values() and Object.entries return Array<mixed> and Array<[string, mixed]> respectively, since Flow currently is never sure that it knows about every property in an object.

v0.22.1

  • Patch release to fix some JSON parsing issues that went out in v0.22.0

v0.22.0

Likely to cause new Flow errors:

  • Overhaul of Flow's understanding of React APIs. Some of these updates remove old/deprecated React APIs. Check out the new React docs for an overview of how things work.

New features:

  • Flow now gives precedence to library definitions over non-@flow implementation files. This means that it should no longer be necessary to specify a node_modules dependency in the [ignore] section of your .flowconfig if you have a library definition defined for that dependency.
  • Significant improvements to Promise.all: We now preserve the type of each item in the array passed to Promise.all() so that it may be propagated through to the resulting .then() handler.
  • We no longer try to parse files that are not marked with an @flow pragma. We anticipate this will improve performance for projects with large, non-Flow node_modules directories.
  • Classes with static members are now subtype-compatible with structural object types
  • It is now possible to specify a leading | or & for type aliases of long unions/intersections. This is useful, as one example, for disjoint unions with a large number of members (where each member sits on a new line):
type MyDisjointUnion =
  | {type: 'TypeOne', ...}
  | {type: 'TypeTwo', ...}
  | {type: 'TypeThree', ...}
  ...
;

Bug fixes:

  • Fixed an issue where an intersection of two object types did not always properly combine to match objects with members on both sides (facebook#1327)
  • Fixed an issue where an object of some intersection type could not be used with the spread operator (facebook#1329)
  • Fixed an issue where refinement-testing on an object of an intersection type wouldn't always work (facebook#1366)
  • Fixed an issue where an intersection of function types with a common return type should type check against function types with union of param types
  • Fixed an issue where refining obj['abc'] didn't behave quite the same as refining obj.abc
  • Fixed an issue where usage of flow get-def on the left-hand side of a require() wouldn't hop through the require() and to the actual location of the definition
  • Fixed an issue where Flow would not give a clear error when trying to use import type to get a non-type export
  • Fixed an issue flow dump-types --json was not as robust as it could be against outputting valid JSON in the event of certain kinds of errors
  • Fixed an issue where Flow would not give a parse error if multiple ES exports with the same name are exported from a single ES module
  • declare class declarations now properly define a built-in name property (like real class declarations do)

v0.21.0

Likely to cause new Flow errors:

  • ES6 react classes without state should now extends React.Component<DefaultProps, Props, void> (previously it was extends React.Component<DefaultProps, Props, {}>)
  • ES6 react classes with state should declare state: State;
  • Before, it was possible to test for properties in objects which did not exist (if (o.noSuchP === foo) { ... }). These kinds of checks will now cause a type error.

New features:

  • Autocomplete for jsx properties
  • Typed JSX intrinsics. This means you can list which jsx intrinsics exist (like div, span, etc) and specify which properties they have.
  • Syntax for declaring variance at definition. For example, interface Generator<+Yield,+Return,-Next> {...}. Still pending transpiler support though.
  • Refining string and union types with string equality now properly refines the types.
  • Support for export * as from @leebyron's Stage1 proposal. Babel support here

Notable bug fixes:

  • Fixed bug with class expressions due to this type
  • Fixed autocomplete for this
  • Recognizes exhaustiveness in switch statements with default case.
  • Fixed "Did not expect BoundT" errors
  • Fixed infinite loop in certain recursive types
  • Fixed an incremental mode issue with deleted files
  • Fixed an incorrect refinement when assigning an object to a variable.

Misc:

  • Some internal errors now will be made user visible instead of silently failing. They generally mean that Flow has some bug or is making an untrue assumption/assertion. If you see these please report them!
  • Improvements to how we report certain types (type application, optional types) via our APIs
  • Various sentinel improvements, including boolean sentinels
  • Various improvements to the builtin flow libraries (thanks everyone for the pull requests!)

v0.20.1

Bug fixes:

  • Ironed out some issues with the this type

Misc:

  • find package.json using normal parsing phase

v0.20.0

New features:

  • Initial support for a this return type for class methods
  • Big improvements on error messages for unions and intersections
  • import typeof * as now allows for concise access to the type of the ModuleNamespace object
  • Flow now understands how to require()/import a .json file

Bug fixes:

  • Fixed an issue where nested unions and intersections might not typecheck as expected
  • Fixed issue where declare type wouldn't work in a declare module that has an exports entry
  • Fixed an issue where the error formatter could fatal in some rare cases
  • Fixed a bug where Function.prototype.bind would lose the types of the params on the function it output
  • Fixed some variance bugs in the built-in Array.prototype library definitions
  • Fixed a bug where using a list that doesn't contain ".js" in module.file_ext would cause internal flow libs to be ignored
  • Fixed autocomplete to work better with general Function types
  • Fixed some issues with const refinement
  • Fixed various issues with export * from (it should work fully now)
  • Fixed a bug where Flow might crash when an export has a wildcard typeparam

Misc:

  • Some improvements to DOM and Node libdefs
  • Various error position relevancy improvements
  • Significantly improved general understanding of special functions like Function.prototype.{bind,call,apply}
  • Improved error messages for import statements where the remote exports don't exist (or may be typo'd)
  • Improvements to understanding of deferred initialization of let variables
  • flow get-def will now hop through lvalues in variable assignments for more fine-grained "hop-tracing" of a variable back to its definition
  • Objects with a callable signature can now be passed in to type positions that expect a function with a matching signature
  • Significant improvements to efficiency/perf when recalculating types based on a change to a file with an already-running Flow server

v0.19.0

Likely to cause new Flow errors:

  • Flow syntax is now disallowed in non-@flow files. Use @noflow to work around this
  • import type * as Foo is now disallowed in favor of import type Foo
  • require() can only take a string literal
  • ES6 react classes without defaultProps should now extends React.Component<void, Props, State> (previously it was extends React.Component<{}, Props, State>)
  • ES6 react classes with defaultProps should declare static defaultProps: DefaultProps;
  • Flow notices errors it missed before in React.createClass() react components
  • Flow is now stricter about using uninitialized variables
  • Stricter checking of in keyword

New Features:

  • flow coverage command
  • null type annotation
  • Support for class field initializers, gated by .flowconfig options
  • You can now override flowlib definitions with local lib files
  • Basic support for computed properties
  • Declaration files (.flow files). Long story short, if foo.js and foo.js.flow exist, Flow will prefer the latter and ignore the former.
  • declare export - a way to declare the exported types in a non-lib file
  • Array rest destructuring assignment support

Notable Bug Fixes:

  • Fix "package not found" error in some symlink situations
  • Object indexer should not imply callable signature
  • Default param values can reference earlier params
  • Fixed a case where we weren't substituting type parameters properly
  • Fixed a situation where Flow would prefer an unchecked module over a library definition

Misc:

  • Add --root arg to most client commands
  • More repositioning of error locations
  • flow get-def: Jump to module named in import statement
  • Lots of fixes to make flow commands smarter about connecting to the server
  • Smarter refinement in a bunch of situations
  • freeze imports on all modules, and require() on ES6 modules
  • You can now spread classes, like var {x} = new Foo()
  • Interfaces now can be callable
  • If you've refined an object property, that refinement survives access through a destructured refinement
  • Better autocomplete results for primitives, objects, functions and unions
  • flow server will write to log file in addition to stdout/stderr

v0.18.1

Likely to cause new Flow errors:

  • Flow is now stricter (and more consistent) about how null works when used as an initialization value for object properties that are mutated later. So let o = {prop: null}; o.prop = 42; is now an error and requires that null be annotated: let o = {prop: (null: ?number)};.
  • The return type of RegExp.prototype.match() is now properly annotated to return a nullable.

New Features:

  • We now take advantage of the guarantee that const variables are read-only when doing refinements. This means that refinements of const variables now have much fewer caveats than refinements of lets or vars. For instance, it's safe to depend on the refined type of a const within a local function created in scope of the refinement, even if the function escapes.
  • We now track which external variables a function actually modifies, and forget refinements to only those variables when a function gets called.
  • New config options: esproposal.class_static_fields=warn|ignore and esproposal.class_instance_fields=warn|ignore. This allows the new ES class fields syntax to be ignored.
  • New config option: module.system.node.resolve_dirname. This allows configuration of the name of the node_modules directory (or directories) used by the node module system. This is similar in behavior to webpack's resolve.moduleDirectories config option.
  • Added support for a <PROJECT_ROOT> token in the template string for the module.name_mapper config option. This token will be replaced with the absolute path to the current project root before mapping the module name. For example: module.name_mapper='^\(.*\)$' -> '<PROJECT_ROOT>/src/\1' would canonicalize an import from "foo/bar/baz" to "/path/to/root/of/project/src/foo/bar/baz".

Notable Bug Fixes:

  • Fixed a bug where we were enforcing TDZ on reads to let/const, but not on writes.
  • Fixed a bug where any refinement clearing that occurred as a result of a function called in an if-statement was forgotten, meaning that lots of refinements were incorrectly allowed to stand.
  • Fixed a bug where generator code couldn't previously call yield without an argument.
  • Several improvements to generators.
  • Various improvements and bug fixes for TDZ enforcement.
  • Various other small improvements to refinements.
  • Fixed an issue where errors could sometimes spew to stdout rather than stderr.

Misc:

  • Removed flow single as it is effectively redundant with flow check --max-workers=1.
  • The "server starting" output now gives more insight into progress.
  • flow --version is now deprecated in favor of flow version.

v0.17.0

New Features:

  • New default error message format shows the code inline (thanks @frantic!)
  • Autocomplete will keep trying even if the file fails to parse
  • You can configure which file extensions Flow looks for (thanks @eyyub!)
  • Support for negative number literal types.

Notable Bug Fixes:

  • Incremental make on OSX now works when lib/ files change
  • Fixed some issues around const destructuring
  • Fixed some issues around destructuring in for-of and for-in loops
  • Some emacs plugin fixes
  • Object spreads are now handled in the correct order
  • Generator return() and throw() methods are now supported
  • Object types now allow keywords as the object keys (thanks @samwgoldman!)
  • importing & exporting default using named specifiers is now supported
  • Flow now understands this in class static methods and this.constructor in class instance methods (thanks @popham!)
  • Fixed bug with array spreads
  • Understand that all classes have a static name property

Misc:

  • Improved flow find-module
  • More error location improvements
  • Object can now be called as a function to cast things to objects
  • We've tried to standardize the error codes with which Flow exits. Some exit codes have changed, but the ones you probably use should be the same. At the moment they're only documented in the code
  • Flow understands the value of a negated number literal

v0.16.0

Likely to cause new Flow errors:

  • Some module exports that didn't require annotations before may now require annotations

New Features:

  • Let/const support! Finally! (Huge props to @samwgoldman...again :] )
  • Support for mixins on declare class library definitions

Notable Bug Fixes:

  • Improvements to types inferred from switch cases that fall through to a default cause
  • Further improvements on symlink support

Misc:

  • Significant performance improvements (both for initial start-up time and running re-calculation time)
  • Improved --traces output

v0.15.0

Likely to cause new Flow errors:

  • Flow now treats class identifiers as being let bound. You cannot refer to a class before it is defined.
  • If you accidentally use a tuple type instead of an array type for a rest param then Flow will complain
  • You cannot use this before super() in a derived constructor, per ES6 semantics
  • Our dictionary property (aka indexer property) support is much more robust and catches things it previously missed.
  • We weren't properly enforcing optional properties in interfaces and declare class. Now we are.

New Features:

  • Generators support, courtesy of @samwgoldman
  • of worker processers is now configurable, defaults to the # of CPUs

  • If Flow knows the value of a boolean expression, then it will know the value of that expression negated.
  • Flow can remember refinements for things like if(x.y[a.b])
  • export type {type1, type2} syntax

Notable Bug Fixes:

  • Fixed issue where Flow would still read package.json for [ignore]'d path
  • Fixed some leaky annotations that let data flow through them
  • Fixed instance and class types to be considered truthy
  • Flow still initializing message now fits in 80 chars, compliments of @spicyj
  • No longer will report hoisted declarations as unreachable code
  • Fixed issue with how Flow chooses its tmp dir
  • An async function can return a T or a Promise<T> and it means the same thing
  • Fixed Flow forgetting about optional properties after an assignment refinement
  • Fixed parser issue around future reserved keywords
  • Optional parameters and rest parameters now work better together

Misc:

  • Updated error locations. We've spent a lot of time auditing our error locations and trying to move them closer to the actual errors.
  • esproposal.decorators option to tell Flow to parse and ignore decorators
  • Bunch of updates to the libraries
  • Some perf work
  • Test output is colorized

v0.14.0

Likely to cause new Flow errors:

  • Assignment now triggers a refinement. If you have a variable that is a ?string and you assign 'hello' to it, Flow refines its type to 'string'.

Likely to fix old Flow errors:

  • We now treat missing type parameters as any. For example, previously ReactElement was treated as ReactElement<*, *, *>. Now it's treated as ReactElement<any, any, any>.

Misc:

  • Basic unsafe support for getters & setters, gated behind the config option unsafe.enable_getters_and_setters
  • Support for block comments inside of Flow's comment syntax
  • Disable by default munging of class property names that start with an underscore, with an option to enable it
  • Lots of small internal fixes and merged PRs
  • Basic semver support for the .flowconfig version
  • Support for declare type in lib files
  • Type annotations are now opaque - other types will not flow through them
  • You can configure the tmp dir that Flow uses

v0.13.1

Likely to cause new Flow errors:

  • Restricted + and += to only allow strings and numbers, and no longer implicitly cast objects, booleans, null or undefined. Use String(x) to explicitly cast these values.
  • Fixed a few bugs where types shared between modules may have lost precision or weren't enforced.

Misc:

  • Added import typeof feature that allows you to import the type of a value export from another module. It is sugar for: import MyThing_tmp from "MyModule"; type MyThing = typeof MyThing_tmp; (except it removes the need for the intermediate MyThing_tmp variable)
  • Added flow ast command to print a serialized JSON ESTree AST. (Note that this AST does not include types, just syntactic structure for now)
  • Added support for class expressions
  • Added support for following symlinks
  • Added support for number-literal and boolean-literal annotations. (useful for things like enum types and refinements based on tests of equivalence between two variables)
  • Added support for ES6 binary and octal integer literals
  • Added support for export type within a CommonJS module that also uses the module.exports = ... pattern
  • Added support for refining some union types down to their disjoint members
  • Added support for covariant Promise type parameters
  • Added improved support for understanding ES5-style imperative class definitions (i.e. via functions + prototypes)
  • Fixed passing undefined to optional parameters
  • Fixed return-type tracking for tagged template usage
  • Fixed an issue where library parse errors would cause the flow server to continuously restart upon initialization without giving an error

v0.12.0

Likely to cause new Flow errors:

  • Fixed a bug where declarations from libraries which are exported from one module are not checked properly in the module into which that module is imported (e.g. if A.foo() returns a Promise, and module B requires A and calls A.foo(), the return type of A.foo() was not being checked properly)
  • Fixed enforcement of Object and Function type annotation arity, so that Object<K, V> errors
  • Restricted valid computed properties, such that only strings and numbers are allowed (notably, disallows null and undefined)

New features:

  • Added support for for-of and support for Iterable interface(s)
  • Added support for async/await
  • Added structural subtyping for interfaces -- anything can be an instance of an interface as long as it looks right
  • Added support for type annotations of the form typeof x, where x is the name of an in-scope variable
  • Added a new config option suppress_comment, a regexp which matches against comments and causes any Flow error on the next line to be suppressed. For example, suppress_comment=.*\$FlowFixMe.* will cause /* $FlowFixMe */\nvar x : number = "oops"; to not raise an error.
  • Added a new config option module.name_mapper, a regexp -> replacement template tuple to be applied to any matching module names before the Flow system resolves the name and looks it up
  • Added a --color=always|never|auto CLI option, useful when piping to less -R
  • Added a --one-line CLI option which replaces \n with \\n in multiline error messages, useful when piping to grep

Misc:

  • Many improvements to library files, especially node and ES6 APIs
  • Improved warnings on unsupported class members [PR #461]
  • Added support for export default class
  • Fixed if (x instanceof Array)
  • Fixed the type of x && y when x is an array, object or function
  • Fixed the flow get-def command, especially around imported types
  • Fixed a bug with == and improved comparison-related error messages
  • Fixed file watching for individual files included via .flowconfig [includes]
  • Fixed the build ID, so that the server restarts when accessed from a mismatched client version
  • Added a new config option log.file which overrides the default log file path

v0.11.0

  • We are now syncing Flow's commit history to GitHub. No more huge updating diffs. We'll also filter the changelog to the most important things.
  • Big React refactoring to support ES6 React classes
  • Do you use any to workaround things that you want to fix later? Well, now you can use $FixMe instead of any and easily grep for these workarounds later.
  • We now report parsing errors in non-@flow files that you are require()'ing/import'ing
  • Better error messages and better error message positions
  • Better error traces, with flow check --traces N, where N is the trace depth
  • Basic support for Object.freeze()
  • Assorted fixes and updates to the flow libs
  • We're trying to be better about commenting the code

v0.10.0

  • Bump version to 0.10.0
  • Support import/export type
  • [PR #412] More fs implementation
  • Support for static overloads
  • Fix order of args matched with overloads
  • Allow methods to have properties
  • [PR #405] Make interface-defined modules work with CommonJS/ES6Module interop
  • Refine mixed
  • Fix typeof null === "object" refinement
  • [PR #397] Facilitate debug builds
  • [PR #401] Improve error message clarity in a few places
  • Remove 'everything is a bool' implicit cast
  • Fix issues with optional properties during InstanceT ~> ObjT
  • Fix abnormals in catch blocks

v0.9.2

  • Fix lowercasing issue where "flow Path/To/Root" became "flow path/to/root"
  • Fix "My Path/To Flow/flow path/to/root" not autostarting server due to spaces

v0.9.1

  • Unbreak the command line for "flow path/to/root" (thanks samwgoldman for the report!)

v0.9.0

  • Bump version to 0.9.0
  • Add Video-, Audio and TextTrackList (+ dependencies)
  • Refine switch cases
  • Better Not_found error
  • [PR #333] Partial fs module implementation
  • Update parser to match esprima-fb
  • [PR #370] Dom canvas context
  • [PR #393] Symbol should be called statically. Fix #391
  • Fix havoc_env to copy the for_type value
  • add bash completion
  • rewrite all the commands to use CommandSpec
  • json_of_t
  • [PR #384] Env printer
  • [PR #383] Add some build/test artifacts to .gitignore
  • [PR #377] Add missing HTMLImageElement properties
  • [PR #367] Re-add merged out oneOfType proptype implementation
  • Allow users to pin their .flowconfig to a specific version
  • colorize test failure diffs
  • Object spread fix
  • [PR #322] Add type signature for node "url", "querystring" and "path" modules
  • command parsing library
  • look for package.json in include paths
  • clear module errors properly
  • add verbose mode

v0.8.0

  • Bump version to 0.8.0
  • [PR #356] Add React.version to lib/react.js
  • [PR #331] node http.get() implementation
  • Fixes for indexers in object types and objects used as dictionaries
  • Flow server speedup
  • Support both commas and semicolons in object type patterns
  • Fix object assign for unresolved objects
  • Add prerr_endlinef
  • Fix support for the mixin pattern of specifying super
  • Incremental typechecking fix
  • Fix up promises interface definition + more tests
  • Perf win by loading master_cx once per job
  • Support for-in of null and undefined
  • Support typeof x === 'boolean'
  • Refine true and false literals
  • Fix refinement unit test
  • Type declarations for Geolocation interface
  • [PR #321] Support for React.cloneElement in 0.13
  • Refine simple assignments (things like while (x = x.parent) { x.doStuff(); })

v0.7.0

  • Bump version to 0.7.0
  • Initial support for ES6 import/export (with CommonJS interop)
  • Updates to CSS/CSSOM interface definitions
  • propTypes in React components now dictate the concrete type signature for this.props
  • Show errors in type-at-pos output
  • Flow now watches include paths specified in .flowconfig for file changes
  • Interpret x != undefined and x != null as the same refinement
  • Use Object.prototype.hasOwnProperty() calls as a refinement
  • Updates to Element and HTMLElement interface definitions

v0.6.0

  • Bump version to 0.6.0
  • Also watch for changes in include paths
  • Fix the Function type to be any function
  • Add Symbol global name to libs
  • Support trailing commas in parser
  • Make methods immutable
  • Remove tuple array length limit
  • [PR #315] Implement more PropTypes
  • Update componentWillReceive spec
  • Unsuppress library errors

v0.5.0

  • Bump version to 0.5.0
  • Add HTMLAnchorElement
  • [PR #295] Add one of proptype
  • Update the parser to work with the new esprima-fb & ast-types
  • [PR #299] Declare prompt function (fixes #204)
  • [PR #303] Add String.prototype.endsWith()
  • quick fix for react/es6 notation
  • extend scope of type params to following bounds
  • reasonless shortcut
  • Add React.findDOMNode to lib/react.js
  • move command documentation into each command
  • fix path in --help usage example
  • fix predicate filtering of null and undefined
  • [PR #292] Types for React synthetic events
  • basic support for bounded polymorphism
  • infer falsiness
  • node haste module support
  • add Abnormal.string

v0.4.0

** Flow comments should be ready for use **

  • Bump version to 0.4.0
  • [PR #259] Add declaration for Document.execCommand()
  • [PR #265] flow status --json should exit 2 on errors
  • Fix issue with switch statement breaks
  • abnormal exit effects of fall-through cases in switch
  • Let AnyObjT flow to KeyT
  • invariant(false, ...) always throws
  • Improve the "Object" annotations
  • sealed object literals
  • fix return types which could be undefined
  • Support type annotations in comments
  • [PR #263] disable colors when TERM=dumb
  • Add lint checks for TRUE / FALSE / NULL
  • class subtyping
  • array literal inference
  • Add unsafe_xhp typechecker option
  • work around false positive conflict markers
  • Better dumping types for debugging

v0.3.0

** Type casts and import type should be ready for use **

  • Bump version to 0.3.0
  • Move haste module name preprocessing into module_js
  • [PR #260] Add SyntheticEvent to lib/react.js
  • Add import type to Flow
  • [Parser] Add esprima tests for typecasts
  • Add support for a module name preprocessor that can re-write require()d module names
  • [Parser] Support import types
  • Allow absolute paths for [libs] and [include]
  • prepare flow-parser to be published to npm
  • [PR #247] Resubmit #113 this fixes #155
  • [PR #246] Fixes #195

v0.2.0

  • Bump version to 0.2.0
  • Fix refinement of optional nullable types
  • Typecast expressions (warning - not added to strip out transform yet)
  • treat throw as similar to return
  • Switch from React to react (React still included until facebook/react#3031)
  • Fix types for sessionStorage and Storage
  • tighter type for undefined values
  • no lib paths fix
  • Fix exporting types for builtin modules
  • Add Number.isNaN and Number.isSafeInteger type annotations
  • Optional properties in objects & optional type revamp

v0.1.6

  • Bump version to 0.1.6
  • declare modules that redefine exports instead of exporting multiple things
  • Object spread race condition fix
  • Fix fallback path to flowlib.tar.gz
  • [Parser] Type grouping bug fix
  • Add Object.is
  • uncomment delete method signatures
  • Add MAX_SAFE_INTEGER and MIN_SAFE_INTEGER to Number
  • make param annotations strict upper bounds

v0.1.5

  • Bump version to 0.1.5
  • [PR #223] from commonlisp/master
  • [PR #221] from teppeis/Javascript-to-JavaScript
  • Better types for React.PropTypes
  • Make React a module
  • Check PropTypes as a normal object too
  • Better support for object call properties
  • Add range/offset information to Ast.Loc.t
  • ignored react attributes key & ref passed in spread properties
  • ignored react attributes key & ref
  • Add some checks when upper bound object type has indexer
  • fix type arg arity exception
  • add traces to .flowconfig
  • fix error message when undeclared prop is set by jsx
  • [Parser] Actually test ArrayTypeAnnotation
  • Fix problem with returns in catch
  • JSX with spread attributes
  • Incremental mode fix
  • Add missing constructors to TypedArray declarations
  • [Parser] Update Flow's test suite to match updated esprima

v0.1.4

  • Bump Flow version to 0.1.4
  • [Flow] Unbreak the open source build
  • [PR #200] from fmahnke/node_http_interface
  • [PR #203] from rsolomo/node-net-isip
  • [PR #201] from unknownexception/patch-1
  • [Flow] Fill out Map definition
  • try-catch
  • missing annotation errors for type aliases
  • Type refinement fixes for early return

v0.1.3

  • Handle strict undefined checks.
  • Add theoretical support to print tuple types properly.
  • Relax the callback type in Array.prototype.forEach
  • Add basic autocomplete support for React classes.
  • [Hack] Kill shell.ml entirely.
  • Handle spread attributes in JSX syntax.
  • [Parser] Allow most keywords as types
  • Add Array.from to lib file
  • [#161]: String literal keys for object type aliases
  • Generalize mock module handling under Haste a bit.
  • Improve autocomplete type printing
  • misc cleanup
  • [Parser] Improve type keywords
  • [Parser] Stop vendoring in ast-types
  • Add an ocaml wrapper for find path1 ... pathN -name pattern
  • Restart if a known lib file changes
  • Add ProgressEvent definition and update two onprogress types
  • [Hack] Add client time to server start time.
  • Improve control flow type refinements
  • [Hack] Reduce dependencies on ParserHeap.
  • Exit server on config change for now rather than restart to avoid some bugs
  • [Parser] ArrowFunction object & array patterns must be wrapped with parens
  • Properly functorize logging code too
  • [Hack] Make GC parameters configurable.
  • Refinements on method calls
  • [Hack] Log whether we are loading from a saved state in INIT_END.
  • [Hack] Improve error handling for saved states.
  • [PR #137] from sverrejoh/master
  • [PR #150] from unknownexception/fix/dom.js
  • [PR #146] from k-bx/master
  • [PR #151] from unknownexception/feature/no_flowlib
  • [PR #144] from rsolomo/node-assert
  • [PR #191] from Shraymonks/HTMLBaseElement
  • [PR #145] from rsolomo/node-util
  • [PR #192] from Shraymonks/HTMLScriptElement
  • Add ES6 String.prototype.contains
  • Add Promise.prototype.done() to Flow lib

v0.1.2

  • [#78] Fallback to index.js if no main attribute in package.json
  • [#82] Added ES6 functions to the Math object
  • [#94] Start a node stdlib interface file
  • [#98] Declare optional parameters according to HTML standard
  • [#108] Add buffer class to node.js interface
  • [#115] Some more node std libs
  • The module system can now be specified in the .flowconfig file
  • Libraries can now be specified in the .flowconfig file
  • Multiple library paths can be specified
  • Added a command to typecheck a file passed on standard input (for IDEs)
  • Added HTMLInputElement to the standard library
  • Improvements to type printing in flow suggest and other commands
  • Fixes to various issues where parser errors were being suppressed

v0.1.1

  • [Issue #4] Typecheck .jsx files
  • [Issue #22] Return a nonzero exit code from 'flow check' if there are errors
  • [IRC report] Autostart the Flow server on all commands
  • Improve the printing of types in 'flow suggest'
  • Add a --timeout option to all commands
  • [PR #27] Clearer error message when 'flow init' hasn't been run
  • [PR #39] Fix to Emacs bindings
  • [PR #53] Support node modules that end in .js
  • [PR #59] Fix example
  • [PR #65] Fix dependencies in flux-chat example
  • [PR #66] Add type definitions for HTMLCanvasElement

v0.1.0

Initial release