v0.38.0

@flow-bot flow-bot released this Jan 18, 2017 · 27 commits to master since this release

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.
  • PR #3127 updated the libdef for document to match the spec. A few popular properties, like document.body and document.activeElement, may be null. In addition, document.getElementById() may return null. Since Flow was not enforcing this before, you may see new errors in your code.

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.

Downloads

v0.37.3

@flow-bot flow-bot released this Dec 20, 2016 · 201 commits to master since this release

Notable bug fixes:

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

Downloads

v0.37.2

@flow-bot flow-bot released this Dec 19, 2016 · 201 commits to master since this release

Notable bug fixes:

  • Fix more issues in the server with rechecking changed files

Downloads

v0.37.1

@flow-bot flow-bot released this Dec 15, 2016

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

Downloads

v0.37.0

@flow-bot flow-bot released this Dec 12, 2016 · 201 commits to master since this release

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.

Downloads

v0.36.0

@flow-bot flow-bot released this Nov 23, 2016

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

Downloads

v0.35.0

@flow-bot flow-bot released this Nov 11, 2016

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)

Downloads

v0.34.0

@flow-bot flow-bot released this Oct 28, 2016 · 438 commits to master since this release

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.

Downloads

v0.33.0

tagged Sep 30, 2016 · 555 commits to master since this release

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 propertly 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 defininition 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

Downloads