flow

Adds static typing to JavaScript to improve developer productivity and code quality.

MIT License

Downloads
42.1M
Stars
22.1K
Committers
931

Bot releases are hidden (Show)

flow - v0.238.2

Published by SamChou19815 4 months ago

Notable bug fixes:

  • Fixed a bug where a recheck triggered by flow force-recheck doesn't respect files.implicitly_include_root=false config.
  • Fixed a bug that causes missing results in find-ref and rename.
flow - v0.238.1

Published by SamChou19815 4 months ago

This release is used to test the release automation powered by GitHub Actions. No changes are expected.

flow - v0.86.0

Published by fishythefish almost 6 years ago

Likely to cause new Flow errors:

  • New errors may arise from generic definitions which lack the necessary annotations. Flow does not infer generic types, and the types it used to infer in their place occasionally masked errors. The types it now infers are still not generic, but will mask fewer errors.
  • Fixed bug in union type checking which caused Flow to miss some errors when used in conjunction with generics and certain utility types.
  • Improvements to constraints involving any may result in new errors.

New Features:

  • type-at-pos can reconstruct spread objects when evaluation of the spread is not possible.
  • type-at-pos now supports implicit instantiation with _.
  • Added core types $ReadOnlyMap, $ReadOnlyWeakMap, $ReadOnlySet, and $ReadOnlyWeakSet. These types and their mutable counterparts mostly follow the pattern of $ReadOnlyArray and Array: the read-only parent class provides non-mutating methods, and the usual mutable class extends it. Unlike $ReadOnlyArray, the new types are invariant in their type parameters.
  • Added the React.StrictMode type.
  • Added the flowtest package. flowtest is a CLI tool for running tests on Flow types.
  • Added the sharedmemory.heap_size option.

Notable bug fixes:

  • Restructured file signatures to support overloading in exports.
  • Allow named exports in exact module.exports objects.
  • Fixed forward references for declare function.
  • Various bug fixes to the type normalizer and to type-at-pos.
  • flow suggest no longer outputs <<anonymous class>>.
  • Imported symbols should no longer appear Remote in type-at-pos.

Misc:

  • Improved formatting in JavaScript output.
  • Improved the way the element type of an array is determined.
  • Various improvements to the AST differ.
  • WeakMap keys must now be objects.
  • Improved profiling for error collation and formatting.
  • When a union lower bound flows into a union upper bound, if both unions are enums, we use the underlying set representation to handle this in O(n log n) time instead of quadratic time.
  • The type normalizer properly represents utility types instead of treating them as generics.
  • The type normalizer provides more accurate information about generics.
  • Flowing a string lower bound into a union upper bound occurs in O(log n) instead of O(n) when the union is an enum.
  • CJS modules' namespace objects are now treated as covariant.
  • The type normalizer reconstructs literal types more precisely when preserve_inferred_literal_types is set. This does not change the behavior of type-at-pos.
  • Deleted the experimental.cancelable_rechecks option.

Parser:

  • Removed the deprecated expression field from Function nodes in the AST.
  • Enabled some tail call optimizations in flow_parser.js which should cause it to stack overflow in fewer cases.
  • The layout generator no longer prints empty statements as {} instead of ; in pretty mode.
  • Allow anonymous function parameter types inside generics inside arrow function return types. For example, we disallow var x = (): (string) => number => 123 because the first => is ambiguous. However, var x = (): T<(string) => number> => 123 is not ambiguous and we no longer disallow it.
flow - v0.78.0

Published by fishythefish about 6 years ago

New Features:

  • Added the unnecessary-invariant lint, which will flag uses of invariant when Flow can determine that the predicate must be truthy.
  • find-refs now traverses union types.
  • The --flowconfig-name flag now allows you to specify the name of the flowconfig.
  • Added a file_watcher option for .flowconfig.
  • Rechecks will now stop and restart as soon as Flow notices other file changes. The previous behavior was to finish the recheck and then start a new recheck. The new behavior is currently off by default and can be enabled by setting experimental.cancelable_rechecks=true in .flowconfig.
    Note: This feature is experimental. When it stabilizes, the flag will be removed and this feature will be enabled by default.

Notable bug fixes:

  • flow-upgrade should no longer trigger ENOENT on Windows.
  • Running Flow with --profile should no longer throw on Windows.
  • Suppression comments preceding lint errors for disabled lints should now be correctly considered unused and trigger unused suppression warnings.
  • ArrayBuffer's static indexer property is now correctly marked covariant. This should prevent errors like this one.
  • Fixed a bug in which the polarity of a type parameter was propagated to all subsequent type parameters, causing errors when covariant type parameters followed contravariant or invariant ones.
    This bug is demonstrated by the difference in behavior of the following examples:

Misc:

  • Flow now prints array types as Array<T> instead of T[] in JavaScript output.
  • Flow now prints {foo:x} as { foo: x } in JavaScript output, as Prettier does.
  • Library definition changes:
    • Added destroyed to net$Socket.
    • Added document.scrollingElement.
    • Added dgram$Socket$rinfo to the Node library definitions.
    • Added WebAssembly library definitions.
    • Added the groups property to RegExp$matchResult.
flow - v0.43.1

Published by gabelevi over 7 years ago

Features:

  • Big perf improvement!
flow - v0.41.0

Published by jeffmo over 7 years ago

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
flow - v0.23.0

Published by gabelevi over 8 years ago

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.
flow - v0.22.1

Published by jeffmo over 8 years ago

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

flow - v0.22.0

Published by jeffmo over 8 years ago

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 (https://github.com/facebook/flow/issues/1327)
  • Fixed an issue where an object of some intersection type could not be used with the spread operator (https://github.com/facebook/flow/issues/1329)
  • Fixed an issue where refinement-testing on an object of an intersection type wouldn't always work (https://github.com/facebook/flow/issues/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)
flow - v0.21.0

Published by gabelevi over 8 years ago

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!)
flow - v0.20.1

Published by gabelevi almost 9 years ago

Bug fixes:

  • Ironed out some issues with the this type

Misc:

  • find package.json using normal parsing phase
flow - v0.20.0

Published by jeffmo almost 9 years ago

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
flow - v0.19.1

Published by gabelevi almost 9 years ago

Bug fix:

  • Fixed error when encountering empty package.json
flow - v0.19.0

Published by gabelevi almost 9 years ago

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
flow - v0.18.1

Published by jeffmo almost 9 years ago

v0.18.1

flow - v0.17.0

Published by gabelevi about 9 years ago

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
flow - v0.16.0

Published by jeffmo about 9 years ago

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
flow - v0.15.0

Published by gabelevi about 9 years ago

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
flow - v0.14.0

Published by gabelevi about 9 years ago

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
flow - v0.13.1

Published by jeffmo over 9 years ago

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