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 visible (Hide)

flow - https://github.com/facebook/flow/releases/tag/v0.191.0

Published by facebook-github-bot almost 2 years ago

Likely to cause new Flow errors:

  • The exact_empty_objects option is now enabled by default. Details about this change and how to update your codebase are covered on our blog.
  • The typeof X type annotation now respects the initialization state of X: if X hasn't been declared it will be an error to get its type.

Notable changes:

  • The enforce_local_inference_annotations config option was removed. To migrate your codebase, run the following codemod to add the required annotations: flow codemod annotate-lti. More details on the changes are explained in the Requiring More Annotations to Functions and Classes in Flow blog post.
  • Literals can be suggested by autocomplete in more cases
  • Fixed autocompleting specifiers in an import statement
flow - https://github.com/facebook/flow/releases/tag/v0.190.1

Published by facebook-github-bot almost 2 years ago

  • Fix a bug on Windows where the server would exit unexpectedly after hg update
  • Performance improvements
flow - https://github.com/facebook/flow/releases/tag/v0.190.0

Published by facebook-github-bot about 2 years ago

Note:
Due to large number of likely new Flow errors that will be introduced in the next release, we decided to create an extra release to ease the upgrade process.
We announced in the recent blog post that we would remove the enforce_local_inference_annotations option in flowconfigs, as it became the default in v0.189.0. This change will be delayed to v0.191.0 instead.

Likely to cause new Flow errors:

  • Flow will now error on indexed write to exact objects without indexed type.
  • Flow now requires that the target of extends clauses in class definitions are either variables, casts, or member expressions, rather than allowing arbitrary expressions.
  • We fixed a bug in which type arguments were not passed to the type parameters of static callable methods.
  • We unblocked constraints involving any and type applications like Promise<T>, which may cause new downstream errors to be discovered.

Notable bug fixes:

  • Fix a bug that can cause the Flow server to unnecessarily restart when Watchman restarts
flow - https://github.com/facebook/flow/releases/tag/v0.189.0

Published by facebook-github-bot about 2 years ago

Likely to cause new Flow errors:

New Features:

  • Class members can be suggested by autocomplete even if this is not typed explicitly.

Notable bug fixes:

  • We will now consistently emit object-this-reference errors. Previously these errors were missing when the object is an argument of Object.freeze(), Object.defineProperties() or Object.create().
  • Fix crash when walking directories that can't be accessed.
  • Fixed a potential crash when two type identifiers are declared in the same block.

Library Definitions:

  • Improve fs.readFile type definition when the encoding config option is supplied.
flow - https://github.com/facebook/flow/releases/tag/v0.188.2

Published by facebook-github-bot about 2 years ago

Bug fixes:

  • Fix crash during incremental recheck

Performance:

  • Improve performance of auto-imports index update for large codebases
flow - https://github.com/facebook/flow/releases/tag/v0.188.1

Published by facebook-github-bot about 2 years ago

Bug fixes:

  • Fix a crash when querying hg

Misc:

  • We renamed the codemod command flow codemod annotate-lti to flow codemod annotate-functions-and-classes to clarify that this is not the only codemod necessary for enabling LTI eventually.
flow -

Published by facebook-github-bot about 2 years ago

Likely to cause new Flow errors:

  • Previously we supported a weird JS runtime rule for constructor returns when you call new SomeClass:

    • If the returned value is primitive, then it's ignored and the instance will be returned instead.
    • If the returned value is object like, then the return object will be the eval result of new SomeClass.

    This is confusing, and we dropped support for this feature in this release. Now we enforce that all class constructors must return void.

  • Fixed a bug preventing refinements from being invalidated in inline && expressions: examples like typeof x === 'number' && reassignXToString() && (x: number) were passing even if reassignXToString() assigned a a string value to x.

New Features:

  • flow codemod annotate-lti is now provided to help prepare your codebase to enable the enforce_local_inference_annotations=true flag. In order to eventually enable local type inference, we will require additional annotations in places we can't contextually type your code. You can enable the annotation enforcement now with enforce_local_inference_annotations=true in flowconfig. This flag enables the behaviors of all the following experimental flags, which will be deleted in the next release:
experimental.enforce_local_inference_annotations=true
experimental.enforce_this_annotations=true
experimental.enforce_class_annotations=true

To migrate your codebase, you can run the following codemod to prepare your codebase for the new requirement: flow codemod annotate-lti. Check out an upcoming blog post for more details.

Misc:

  • Remove the file_watcher.watchman.survive_restarts flowconfig option, which was deprecated in 0.158.0. We will always try to survive Watchman restarts.
  • Remove the experimental.refactor flowconfig option. It has been true by default since v0.158.0.

Library Definitions:

  • Updates the typing of fs.promises.readdir() to reflect the possibility of passing withFileTypes: true and receiving an array of Dirent objects
flow - https://github.com/facebook/flow/releases/tag/v0.187.1

Published by facebook-github-bot about 2 years ago

  • Fix a crash introduced in 0.187.0 when the file walker fails to open a directory
flow - https://github.com/facebook/flow/releases/tag/v0.187.0

Published by facebook-github-bot about 2 years ago

Likely to cause new Flow errors:

  • JSX expressions in a file with jsx pragma of member expressions (e.g. @jsx Foo.bar) will no longer be incorrectly considered as unreachable. This might uncover previously hidden errors.
  • Functions statics (i.e. assigning properties to functions) are safer, but also a bit more restricted. Function statics should be assigned in the same statement list as the function (i.e. not conditionally).

New Features:

  • When autocompleting in the middle of a word, autocomplete now inserts the suggestion, instead of replacing the entire word. For example, if you are completing in foo|Baz (cursor at |) and choose fooBar, you'll now get fooBarBaz instead of fooBar. In VS Code, you can press shift-enter to replace instead of insert.

Bug fixes:

  • Fix Go to Definition on certain kinds of import statements
  • Improve location of error references pointing at imported namespaces (D38978756 mroch)
  • Fix some missing references in CLI errors (D38977164 mroch)
  • Improve location of error messages referring to declare module exports (D38977152 mroch)
  • Change flow get-def --json to write {"error": message} to stdout on error, instead of writing non-JSON to stderr
  • Fix a garbage collector bug that rarely could lead to crashes

Library Definitions:

  • Allow access of arbitrary properties from import.meta. They are typed as mixed
  • Add support for MediaSourceHandle
flow - https://github.com/facebook/flow/releases/tag/v0.186.0

Published by facebook-github-bot about 2 years ago

Notable breaking changes:

  • Support for inference_mode=classic has been removed. The default is now inference_mode=constrain_writes. Please refer to the blog post for migration paths. Additionally we have removed all codemod commands that depend on the classic inference mode. This includes the annotate-declarations, rename-redefinitions and annotate-escaped-generics codemods.

Likely to cause new Flow errors:

  • Exported functions can only have properties assigned in the same scope as the function.
  • Improve behavior of index property access with union types (try-Flow example). May cause new errors in interaction with computed properties.
  • Referencing this in object getters and setters are now banned. Referencing this in object methods are already banned, and this change makes Flow's behavior more consistent.

Notable bug fixes:

  • Fixed a regression in destructuring checking with computed properties (issue).

Library Definitions:

  • Added PerformanceServerTiming definition and the serverTiming attribute to PerformanceResourceTiming.
flow - https://github.com/facebook/flow/releases/tag/v0.185.2

Published by facebook-github-bot about 2 years ago

New Features:

  • Flow now supports the @jsxRuntime pragma in the top docblock of each JS module. Allowed values are classic and automatic.
flow - https://github.com/facebook/flow/releases/tag/v0.185.1

Published by facebook-github-bot about 2 years ago

Misc:

  • Improve the experimental mode to rank autoimport suggestions by how often they're imported (autoimports_ranked_by_usage=true)
flow - https://github.com/facebook/flow/releases/tag/v0.185.0

Published by facebook-github-bot about 2 years ago

Likely to cause new Flow errors:

  • Unbound names in jsx-pragma when the jsx-pragma is not a simple identifier will now consistently point to the jsx pragma.
  • Errors previously hidden by method-unbinding will reappear.
  • Fix a bug that makes assignments in loop guards like x = some expression containing x have a type that's effectively any. If you turned on inference_mode=constrain_writes since the last release, there will be new errors.
  • Remove esproposal_export_star_as as an option and make this the default as it made it into the JS standard in 2018.
  • Additional value-as-type errors might be emitted, as a result of existing importing errors.
  • Object rest on instances no longer results in an unsealed object (that can have properties added after the fact)

New Features:

  • inference_mode=constrain_writes will be the default. inference_mode=classic, which is the current default, will be removed in the next release. Please refer to the blog post for migration paths.

Misc:

  • Fix flow-remove-types/jest transformer to be compatible with Jest 28. (Thanks @carloscuesta)
  • Add codemod to remove annotations in destructuring - which we banned in 0.176

Library Definitions:

  • Add missing .x and .y properties to DOMRect. (Thanks @pmer)
flow - https://github.com/facebook/flow/releases/tag/v0.184.0

Published by facebook-github-bot about 2 years ago

Upcoming Breaking Changes:

  • New Inference Mode:

    We are releasing a new inference mode that marks significant progress on our way to local type inference. You can enable this new mode in your codebase by adding inference_mode=constrain_writes to the [options] section in the flowconfig.

    We will make inference_mode default to constrain_writes in v0.185, and remove the classic option in v0.186. To migrate your codebase, you can run the following codemods to prepare your codebase for the new inference mode:

    flow codemod rename-redefinitions
    flow codemod annotate-declarations
    

    We will describe more details on this inference mode in an upcoming blog post.

  • Additional Annotation Requirements:

    In order to eventually enable local type inference, we will require additional annotations in places we can't contextually type your code. You can enable the annotation enforcement now with the following flags in flowconfig:

    experimental.enforce_local_inference_annotations=true
    experimental.enforce_this_annotations=true
    experimental.enforce_class_annotations=true
    

    To migrate your codebase, you can run the following codemod to prepare your codebase for the new requirement: flow codemod annotate-lti-experimental

Likely to cause new Flow errors:

  • Object.create now results in a sealed object. Arbitrary properties can no longer be read/written from/to it. You can use the __proto__ property in object annotations to create an annotation if you need to.

Notable bug fixes:

  • Fix spurious object subtyping errors when an object literal is passed into rest arguments with tuple type
    function emit(...args: [{+bar: string}]): void {}
    emit({ bar: "" }); // no longer emits incompatible-variance
    
  • Fix a bug on Windows that could lead to a crash if files are changed faster than they can be rechecked

flow-upgrade:

  • Add a codemod to collapse multiline object initialization into one object literal - useful for enabling the exact_empty_objects flowconfig option

Library Definitions:

  • Add DOMTokenList index signature
flow - https://github.com/facebook/flow/releases/tag/v0.183.1

Published by facebook-github-bot about 2 years ago

  • Fix a regression in 0.183.0 on Windows where inconsistent handling of slashes within paths led to mismatches like "duplicate provider" errors
flow - https://github.com/facebook/flow/releases/tag/v0.183.0

Published by facebook-github-bot over 2 years ago

Likely to cause new Flow errors:

  • We now emit new errors in places where an object literal has literal types, but doesn't have an annotation. You can usually fix these errors by adding annotations to object literals.

New Features:

  • Allow export of empty object without annotation when exact_empty_objects is enabled.
  • Improve annotate useState codemod to support null/undefined/empty-array arguments.

Notable bug fixes:

  • Allow flowconfigs with blank lines before the first config section.
  • Fix location of error message about legacy octal number types.
  • Fix inconsistent blank lines around auto-imports.
  • Fix bug where Watchman events might be ignored on Windows.

Parser:

  • Fix parser exception on negative binary and octal number types that contain whitespace after the minus sign.

Library Definitions:

  • Improved fs.readdir and fs.readdirSync to allow better overload resolution.
  • Add String.prototype.replaceAll() (Thanks @dav-s).
flow - https://github.com/facebook/flow/releases/tag/v0.182.0

Published by facebook-github-bot over 2 years ago

Likely to cause new Flow errors:

  • var re-declarations are now banned. You should use let or const instead.
  • Flow will now emit escaped-generic errors when the return type of a generic predicate function contains type parameters defined by the function.

Notable bug fixes:

  • Improve ordering of autoimport suggestions, so that globals are suggested above named imports.

Misc:

  • Errors related to class expressions might have new locations.
flow - v0.181.2

Published by facebook-github-bot over 2 years ago

  • Fix the rendering of classes in autocomplete results
  • Fix the ordering of class methods in autocomplete results
  • Improve ability to recover from Watchman restarting (the fix in 0.181.0 was incomplete)
  • Fix a bug where warnings would be incorrectly reported when using saved state, and could cause a crash.
  • Add --saved-state-verify flag to check that a saved state matches what is expected to be on disk.
flow - https://github.com/facebook/flow/releases/tag/v0.181.1

Published by facebook-github-bot over 2 years ago

Notable bug fixes:

  • The JS build for try-flow is now fixed. It's recently broken since the 0.181.0 release.
flow - https://github.com/facebook/flow/releases/tag/v0.181.0

Published by facebook-github-bot over 2 years ago

Notable bug fixes:

  • Fix unsound spreading of empty array literals (example)
  • Fix a race condition that could cause individual requests from the IDE to hang indefinitely
  • Improve ability to recover from Watchman restarting

Parser:

  • Fix parsing of invalid UTF-8 to raise the correct "Malformed unicode" parse error
  • Fix line numbers when regex character classes contain an (invalid) newline, which could've led to a crash

Library Definitions:

  • Add AudioContext constructor options
  • Update Node's v8 module