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

Published by facebook-github-bot over 5 years ago

  • The inferred statics object type of React.createClass({}) will contain defaultProps: void, instead of defaultProps: {||} (unsealed empty object).
  • Bug fix in internal cache mechanism
flow -

Published by facebook-github-bot over 5 years ago

  • Added an overload for JSON.stringify allowing mixed input, which returns string | void. Without this, you can't call JSON.stringify on a mixed value at all, because while Flow does allow refining mixed to "not void" (e.g. x === undefined ? undefined : JSON.stringify(x)), it does not support refining mixed to "not a function" (e.g. imagine you could do x === undefined || typeof x == 'function' ? undefined : JSON.stringify(x)). This rolls back some of the more restrictive behavior introduced in v0.95.0, but is still more restrictive and more accurate than in <= v0.94.0.
flow - https://github.com/facebook/flow/releases/tag/v0.95.0

Published by facebook-github-bot over 5 years ago

Likely to cause new Flow errors:

  • Disallow undefined and functions in JSON.stringify: JSON.stringify(undefined) returns undefined instead of string. Rather than make it always return string | void, or use overloads to return void on those inputs, we instead disallow those inputs since they are rarely the intended behavior. (#7447)

New features:

  • flow batch-coverage: A new command to compute aggregate coverage for directories and file lists. Instead of producing the coverage at each location, it sums them and reports the per-file percentage and the aggregate percentage.

Bug fixes:

  • Fixed incorrect reporting of signature verification lint errors in unchecked files

Other improvements:

  • #7459 Add type for Symbol.prototype.description (thanks @dnalborczyk)
  • #7452 Add types for String.prototype.trimStart/trimEnd (thanks @dnalborczyk)
  • #7500 The "kind" of an autocomplete result is now reported over the Language Server Protocol, improving the autocomplete UI (thanks @vicapow)
flow - https://github.com/facebook/flow/releases/tag/v0.94.0

Published by facebook-github-bot over 5 years ago

Bug fixes:

  • Fixed dynamic-exports lint's spurious errors on exported classes and functions
  • Handle package.json files that are valid JSON but invalid packages

Performance:

  • Reduce memory usage by filtering suppressed lint errors before formatting the errors for printing
  • Quicker responses to cancellation requests

Many libdef fixes and other improvements from the open source community:

  • #3209 Fix autocomplete for generic type aliases (thanks @vkurchatkin!)
  • #6750 Remove shadowed generics in Proxy$traps (thanks @talbenari1!)
  • #6000 Document async function return type (thanks @callumlocke!)
  • #7448 Tweaks to built-in http module (thanks @STRML!)
  • #4570 Update types for Web Audio API (thanks @fand!)
  • #5836 Fix examples in libdefs/creation page (thanks @tomasz-sodzawiczny!)

Additional lib def improvements:

  • Make current write-only in React.Ref - allowing union types for ref
  • Add setMediaKeys API to definition of HTMLMediaElement
  • Make type parameter to http$Agent covariant
flow - https://github.com/facebook/flow/releases/tag/v0.93.0

Published by facebook-github-bot over 5 years ago

Likely to cause new Flow errors:

  • Removed a constraint involving any types and React proptypes for efficiency. This may result in some errors no longer being reported.

New Features:

  • A new lint (dynamic-export) which when enabled will warn when most dynamic types are exported from a file.
  • Flow now distinguishes between any and empty when computing line coverage. empty types are colored blue and any types red when using the --color option. Note that this may cause new expressions to be considered uncovered.

Notable bug fixes:

  • Fixed a non-termination condition during this-substitution.
  • Fixed an issue where inexact-spread lint errors could appear in the wrong position.

Many, many libdef fixes and improvements! Many thanks to the open source community for these, and to @nmote and @jbrown215 for reviewing and merging so many of these!

  • #4388 add missing InputEvent(Listener|Handler|Types|) (thanks @keithamus!)
  • #4664 Fix IntersectionObserver constructor definition (thanks @apostolos!)
  • #4858 Make ServiceWorkerMessageEvent extend ExtendableEvent (thanks @keyiiiii!)
  • #4772 add indexer property to string lib def (thanks @zacharygolba!)
  • #5529 Add module.builtinModules to core libdef (thanks @simenB!)
  • #5574 fix return parameter for writable.setDefaultEncoding() (thanks @dnalborczyk!)
  • #5578 add util.callbackify to node type def (thanks @dnalborczyk!)
  • #5628 Add lib declaration for BroadcastChannel (thanks @schmatz!)
  • #5866 Add definition for timingSafeEqual() (thanks @rolftimmermans!)
  • #5988 add destroy method to streams (thanks @hiikezoe!)
  • #6091 Fix static declarations for XMLHttpRequest (thanks @robin-pham!)
  • #6339 Fix parent of AnimationEvent (thanks @ngyikp!)
  • #6367 Add types for Object.getOwnPropertyDescriptors (thanks @disnet!)
  • #6471 Actualize node's EventEmitter API definition (thanks @antongolub!)
  • #6535 add Element.prototype.toggleAttribute (thanks @keithamus!)
  • #6614 Add TransitionEvent to dom libdef (thanks @koddsson!)
  • #6785 Allow specifying encoding as string in options field of appendFile, appendFileSync (thanks @cappslock!)
  • #6963 Add Audio declaration (thanks @vldvel!)
  • #7011 Use more specific type for navigator.serviceWorker (thanks @dhui!)
  • #7097 Add type definitions for message events (thanks @wachino!)
  • #7122 Support for Uint8Array (thanks @cakoose!)
  • #7144 Updated URL modules definitions for Node.js 10 (thanks @MrFranke!)
  • #7146 Fix type definition of Node.js dns.lookup() (thanks @shuhei!)
  • #7215 fix https interfaces (thanks @cakoose!)
  • #7225 make createContextualFragment return a DocumentFragment (thanks @wincent!)
  • #7342 add Document.queryCommandSupported (thanks @Eazymov!)
  • #7358 Add oncontextmenu to HTMLElement (thanks @jasonLaster!)
  • #7363 Add MediaDeviceInfo declaration (thanks @ea167!)
  • #7367 Add userSelect to CSS declaration (thanks @shubhodeep9!)
  • #7368 Fix fs.promises.readFile being incorreclty overloaded (thanks @Macil!)
  • #7381 add EventSource to dom libdef. Likely to cause new errors (thanks @SlIdE42!)
  • #7386 fix XDomainRequest in bom libdef. Likely to cause new errors (thanks @Mouvedia!)
  • #7387 Added optional displayName property to React$Context (thanks @bvaughn!)
  • #7405 Basic support for typeof x === 'symbol' (thanks @mroch!)
  • #7420, #7430 and #7440 Various React improvements (thanks @threepointone!)
  • #7423 make useRef type non-nullable (thanks @trysound!)
  • #7445 add Stream type to Node thanks (thanks @goodmind!)

Misc:

  • Updated our website and GitHub issue template to make it easier for open source users to contribute to Flow!
  • Various improvements to the AST, including the differ, typed AST and the AST mapper
flow - https://github.com/facebook/flow/releases/tag/v0.92.1

Published by facebook-github-bot over 5 years ago

Notable bug fixes:

  • Fixed a bug introduced in v0.92.0 which could cause the server to crash when using an IDE.
  • Fixed module.system.haste.name_reducers option for Windows (#7419 - thanks jamesisaac)
flow -

Published by facebook-github-bot over 5 years ago

Likely to cause new Flow errors:

Some fixes to tagged template literals will surface a new set of pre-existing errors!

New Features:

This release culminates months of hard work on quality of life improvements for IDE support.
Expect your requests to be faster, and your requests to take a bit less time.

  • Several Flow commands can run in parallel now, i.e. you can still get type definitions while rechecking.
    Big props to @gabelevi for this massive QoL improvement!
  • Alongside this change, @gabelevi also released a new lazy-check mode that leverages watchman to reduce the number of checked files.
    Learn about it in the docs.

Notable bug fixes:

Thank you to the opensource community for these fixes!

  • #7354 Fix MouseEvent type definitions
  • #7262 Update types for WeakMap
  • #7100 Add missing crypto.randomFillSync and crypto.randomFill methods
  • #7356 Add definitions for new debug hook useDebugValue
  • #7352 Rename React hook useImperativeMethods -> useImperativeHandle
  • #5665 Fix arity of clearInterval, clearTimeout
  • React.memo now accepts any kind of Component
flow - https://github.com/facebook/flow/releases/tag/v0.91.0

Published by facebook-github-bot almost 6 years ago

Likely to cause new Flow errors:

  • Better positioning for React error messages. This may move already existing (and suppressed) errors to new positions.

New Features:

  • The --lazy-mode flag was added to all commands that may autostart a server

Notable bug fixes:

Misc:

  • Various additions and typo fixes on flow.org docs and README (thanks @fschindler, @dominicfraser, @keithamus, and @fterh)
  • Misc OCaml tweaks (thanks @rvantonder)
  • Huge reduction (~15%) in total memory usage (thanks @nmote)
  • Huge reduction in error collation time (thanks @panagosg7)

0.90.0

Likely to cause new Flow errors:

  • Removed unsafe rule allowing Date instances to be used as a number
  • Changed $Shape<> types to reject null and void as subtypes
  • Removed unsafe refinement from mixed to a function type using typeof

Pull Requests:

  • #7290 Add support for Path2D constructor arguments (thanks @zpao!)
  • #7221 use package that works with 7.x in babel doc (thanks @rob2d!)
  • #7231 Improve type of 'mkdir' and 'mkdirSync' (thanks @mrtnzlml!)
  • #7278 fix: update toc links in hoc pages (thanks @evenchange4!)

Notable bug fixes:

  • Fixed issue where errors involving $Shape<> types were positioned poorly

Parser:

  • Fixed decoding of html entities at beginning of JSX children
  • Fixed offset calculation in estree output to account for multibyte characters
flow - v0.90.0

Published by facebook-github-bot almost 6 years ago

Likely to cause new Flow errors:

  • Removed unsafe rule allowing Date instances to be used as a number
  • Changed $Shape<> types to reject null and void as subtypes
  • Removed unsafe refinement from mixed to a function type using typeof

Pull Requests:

  • #7290 Add support for Path2D constructor arguments (thanks @zpao!)
  • #7221 use package that works with 7.x in babel doc (thanks @rob2d!)
  • #7231 Improve type of 'mkdir' and 'mkdirSync' (thanks @mrtnzlml!)
  • #7278 fix: update toc links in hoc pages (thanks @evenchange4!)

Notable bug fixes:

  • Fixed issue where errors involving $Shape<> types were positioned poorly

Parser:

  • Fixed decoding of html entities at beginning of JSX children
  • Fixed offset calculation in estree output to account for multibyte characters
flow -

Published by facebook-github-bot almost 6 years ago

Likely to cause new Flow errors:

  • Big revamp to React typing with the goal of adding support for React.forwardRef and better typing higher-order components. Docs are available here.

New Features:

Notable bug fixes:

  • flow coverage --color handles multi-byte characters better
  • flow coverage now supports --strip-root

Misc:

  • We've deleted flow gen-flow-files due to bitrot. We do plan on building a better version in the future.
  • Various libdef updates. Thanks for all the PRs!
flow - https://github.com/facebook/flow/releases/tag/v0.88.0

Published by facebook-github-bot almost 6 years ago

Likely to cause new Flow errors:

  • Made Function and Object types be aliases for any. They were always unsafe types, just like any, but they had peculiar behavior. This change revealed places where they were handled improperly within Flow, and ended up surfacing type errors that were previously missed.

New Features:

  • Added the experimental Watchman lazy mode (flow start --lazy-mode watchman). This improves the lazy mode experience for repositories which use Mercurial and Watchman. We will document it more when/if it proves itself.
  • Added flow config check which validates the .flowconfig.

Misc:

  • Made miscellaneous improvements to the AST differ, which improves the output of global rename.
  • Made .flowconfig parsing less strict (in particular, if the --ignore-version flag is passed, do not fatal on unrecognized config options).
  • Performed a code cleanup in type normalization that caused some types in type-at-pos to be displayed differently.
  • Removed redundant information in stored ASTs resulting in a modest reduction in memory usage.
  • Flow assigns long string literals type string, rather than the singleton type of that literal. Now, this fact is surfaced in error messages.
  • Fixed stack overflows:
    • When checking a large number of files.
    • When a large number of errors are present.

Libdefs:

  • Added React.Suspense.
  • Removed React.useMutationEffect hook.
flow - v0.87.0

Published by facebook-github-bot almost 6 years ago

Likely to cause new Flow errors:

  • Fixed an error in the React.createRef definition. Refs are for any type of value,
    not just React elements.

New Features:

  • Added support for subcommands to the CLI and a flow config find command that
    finds the .flowconfig governing path.

Notable bug fixes:

  • Fixed file_sig for deep destructured requires.
  • Fixed a stack overflow in the flow ls --json command.
  • Fixed a crash when the module reference prefix is used on an untyped module.

Misc:

  • Removed the flow port command.
  • Various improvements to the AST differ.
  • Made progress in shifting from concrete to abstracting locations, by
    • functorizing a number of modules over their use of locations, and
    • updating the core typechecking logic to operate solely on structures containing
      abstract locations.
  • Removed the redundant Expression.Member.computed field from the AST.
  • Allow configuring path to node in runtests.sh.
  • Refactored JSX.frag_closingElement of the AST to not be an option.
  • Fixed error localization in import type and import typeof with default.
  • Added the location of function signatures to the AST.
  • Removed prototype members when autocompleting JSX props.
  • Cleaned-up handling of the mixed case from LookupT.
  • Optimized the case of enumerations when used as keys.

Library definition changes:

  • Made geolocation PositionOptions optional.
  • Added flow definitions for React hooks.
  • Added a calculateChangedBits parameter to the React.createContext definition.
  • Added React.ConcurrentMode and React.StrictMode definitions.
  • Added React.lazy and React.memo definitions.

Parser:

  • Refactored flowconfig option parsing into a list of parsers.
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 - https://github.com/facebook/flow/releases/tag/v0.85.0

Published by facebook-github-bot almost 6 years ago

Likely to cause new Flow errors:

  • Fixed an issue that caused missing annotations errors to be suppressed.

    Please read the full post
    for more information on what changed and tips on dealing with the new errors.

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

Published by facebook-github-bot almost 6 years ago

Likely to cause new Flow errors:

  • Earlier, type constraints between any and other types would be dropped. Instead, they are now
    propagated. In some cases, this unblocks further constraint solving and helps find more errors.
  • When a variable is equality-checked with a literal, the variable's type is refined. Earlier, if
    the variable's type was incompatible with the literal's type, it would silently be refined to
    empty, whereas now this is an error.

New Features:

  • Added support for wildcard (_) type arguments to function / constructor calls. This is
    especially useful when some type arguments are sufficient to pin down the type of the result; the
    others can simply be _.

Notable bug fixes:

  • Fixed a case that would crash get-def and find-refs
  • Fixed a bug with unreachability analysis for ternary expressions
  • Fixed a bug with refinements merging at the end of switch statements

Misc:

  • Fixed various AST printing / layout bugs
  • Made various improvements to the AST differ
  • Refactored parts of get-def and find-refs to reuse code
  • Made progress on abstracting locations in the core type inference engine
  • Made progress on module signature verification and generation
  • Merged PRs that improve type declarations: e.g., getBoundingClient returns a DOMRect instead of a ClientRect.

Parser:

  • Support for ... to indicate inexactness in object types
flow - https://github.com/facebook/flow/releases/tag/v0.83.0

Published by facebook-github-bot about 6 years ago

Likely to cause new Flow errors:

  • Fixed a bug where type precision was lost at module boundaries

Notable bug fixes:

  • Prevented an exponential blowup when union types flow into "maybe" (?T) or "optional" (essentially T | void) types
  • Allowed {p:T} to be a subtype of $Shape<{+p:T}>

Misc:

  • Fixed exception when using --traces
  • Changed --verbose to not log while loading flowlibs by default; pass --verbose-flowlibs to override
  • Added ability for LSP clients to cancel previously-sent commands
  • Improved location of diagnostics via LSP while typing
  • Fixed LSP textDocument/definition response when there are no results (prevents bogus jump-to-definition inside comments, for example)
  • Limited number of errors returned via LSP to 200, to improve Nuclide and Visual Studio performance
  • Fixed an exception when attempting to focus a file that Flow ignored

Library definition changes:

  • Added ResizeObserver declarations
  • Added missing net$Server.listening property
  • Added process.cpuUsage()

Parser:

  • Fixed export default async function to be a FunctionDeclaration not a FunctionExpression
  • Made instance properties named 'constructor' a syntax error
flow - https://github.com/facebook/flow/releases/tag/v0.82.0

Published by facebook-github-bot about 6 years ago

Likely to cause new Flow errors:

  • Removed the ability to use functions as type annotations. This ability was
    originally designed to support ES3-style classes, but in practice causes
    confusion and missed errors. We found that the vast majority of added errors
    were detecting legitimate bugs, and the remainder could be easily updated to
    ES6 classes.

New Features:

  • Added worker utilization and GC profiling under the --profile mode.

Misc:

  • Further improved performance of IDE requests on large codebases.
  • Tweaked OCaml GC settings to reduce time spent collecting on workers.
  • Improved performance and reliability of watchman integration.
flow - https://github.com/facebook/flow/releases/tag/v0.81.0

Published by facebook-github-bot about 6 years ago

Likely to cause new Flow errors:

  • Fixed a bug which allowed refinements to incorrectly escape outside of conditional expressions.
  • Plugged a hole which incorrectly allowed this to appear in a constructor before a super call in some cases.
  • Some errors related to uses of typeof may be reported at a different location than they previously were.
  • Disallowed shadowing class methods with incompatible properties of the same name.
  • Made miscellaneous other bug fixes that manifest only in rare cases.
  • Made module properties covariant, meaning that e.g. mutating properties on the object returned by require() is not allowed.

Notable bug fixes:

  • Improved performance of IDE requests (e.g. autocomplete, get-def) on large codebases roughly 3x.

Misc:

  • Made a number of improvements to the diffs generated by global rename.
  • Changed how saved-states are loaded.
  • Added additional information to error messages for missing annotations for type parameters.
  • Disallowed class static properties named prototype or constructor.

Library definition changes:

  • Added type definitions for pointer events.
  • Updated DOM scrollIntoView to match latest spec.
  • Updated String.prototype.toLocaleLowerCase and toLocaleUpperCase to allow optional locale parameter.
  • Made Object.prototype.valueOf return mixed instead of Object.
  • Removed the indexer from the Object libdef.
  • Updated TextDecoder to properly accept a BufferSource.
  • Added MediaStreamTrackEvent definition.
  • Made String.match return RegExp$matchResult.
  • Added additional constants to the fs module.
flow - https://github.com/facebook/flow/releases/tag/v0.80.0

Published by facebook-github-bot about 6 years ago

Likely to cause new Flow errors:

  • We've changed how Flow lint severity is calculated. We used to look at every location mentioned by a lint and we'd use the lowest severity, where Off < Warn < Error. Now we just use the severity at the lint's first location. Flow suppression comments (e.g. // $FlowFixMe) can still suppress a lint at any mentioned location. Depending on your setup, this change may expose Flow lints which were turned off by accident. For example, a "Sketchy Null Check" lint in a file with that lint set to error would have been turned off if it also mentions a file with that lint off. Now that lint will show up as an error.
  • Some libdef changes may cause a few errors. For example, Headers.get and URLSearchParams.get are now annotated to return null | string instead of string and File.lastModifiedDate: any was replaced with File.lastModified: number.

Notable bug fixes:

  • Fixed a crash that could happen when a persistent connection disappears.

Misc:

  • Many improvements to the libdefs and docs. Thanks for the PRs, everyone!
  • Small perf improvement by making BoundT (internal representation of type parameter bounds) smaller.

Parser:

  • Small change to the OCaml AST for the extends expression in a class declaration. Moved a couple of properties to their own node.
flow - https://github.com/facebook/flow/releases/tag/v0.79.1

Published by facebook-github-bot about 6 years ago

Notable bug fixes:

  • If a server was not already started, running flow status --flowconfig-name 'name'
    would start a server without taking into account the new flowconfig name. The same
    is true for running flow without any command specified. This changes this by
    passing the name to the new server.