Skip to content

Releases: facebook/flow

v0.24.2

06 May 00:08
Compare
Choose a tag to compare
  • Fixed a bug where Flow might run out of memory in a repository with a lot of non-flow files

v0.24.1

02 May 15:39
Compare
Choose a tag to compare
  • Fixed a bug where autocomplete can show internal variable names for files that use destructuring

v0.24.0

29 Apr 13:40
Compare
Choose a tag to compare

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

21 Apr 20:31
Compare
Choose a tag to compare
  • Fixed parsing of JSON files with duplicate object keys

v0.23.0

13 Apr 22:31
Compare
Choose a tag to compare

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

02 Mar 21:01
Compare
Choose a tag to compare

A patch release to fix some JSON parsing issues that went out in v0.22.0

v0.22.0

20 Feb 17:08
Compare
Choose a tag to compare

Likely to cause new Flow errors:

  • Several updates to Flow's understanding of React's APIs. Some of these updates remove old/deprecated React APIs.

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 (#1327)
  • Fixed an issue where an object of some intersection type could not be used with the spread operator (#1329)
  • Fixed an issue where refinement-testing on an object of an intersection type wouldn't always work (#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

01 Feb 23:18
Compare
Choose a tag to compare

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;

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 visibile 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 buildin flow libraries (thanks everyone for the pull requests!)

v0.20.1

18 Dec 21:54
Compare
Choose a tag to compare

Bug fixes:

  • Ironed out some issues with the this type

Misc:

  • find package.json using normal parsing phase

v0.20.0

16 Dec 20:20
Compare
Choose a tag to compare

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