Adds static typing to JavaScript to improve developer productivity and code quality.
MIT License
Bot releases are visible (Hide)
Published by facebook-github-bot about 6 years ago
Likely to cause new Flow errors:
New Features:
--saved-state-no-fallback
is passed in which case Flow fails.name
field in the [options]
portion of .flowconfig
.Notable bug fixes:
flow --json
with a large error output, byflow suggest
.Misc:
React$Context.Provider
andCanvasRenderingContext2D.imageSmoothingQuality
.$Shape
.types_js.ml
, merge_service.ml
, rechecker.ml
, etc.).Published by fishythefish about 6 years ago
New Features:
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.--flowconfig-name
flag now allows you to specify the name of the flowconfig.file_watcher
option for .flowconfig
.experimental.cancelable_rechecks=true
in .flowconfig
.Notable bug fixes:
flow-upgrade
should no longer trigger ENOENT
on Windows.--profile
should no longer throw on Windows.ArrayBuffer
's static indexer property is now correctly marked covariant. This should prevent errors like this one.Misc:
Array<T>
instead of T[]
in JavaScript output.{foo:x}
as { foo: x }
in JavaScript output, as Prettier does.destroyed
to net$Socket
.document.scrollingElement
.dgram$Socket$rinfo
to the Node library definitions.groups
property to RegExp$matchResult
.Published by facebook-github-bot over 6 years ago
New Features:
a && b
when a
is a number
. See https://flow.org/en/docs/linting/rule-reference/#toc-sketchy-number
Notable bug fixes:
Misc:
Context
, added readAsBinaryString
to FileReader
Parser:
Published by facebook-github-bot over 6 years ago
Likely to cause new Flow errors:
New Features:
[silence]
section in the .flowconfig
which can suppress all errors in 1 or more files. Thanks @LegNeato! (#4916)flow server --file-watcher watchman
flag which uses Watchman for file watching instead of the builtin file-watcher, dfind--expand-type-aliases
flag to type-at-pos
. It replaces type aliases with their bodies in the returned type.flow save-state
command to generate a saved state file (experimental & loading a saved state isn't ready yet)Notable bug fixes:
type-at-pos
for B
in import type { A as B } from 'M';
find-refs
, autocomplete
, get-def
, etc for $Facebookism$Idx
Misc:
type-at-pos
output+
operator to match other binary operatorsPublished by facebook-github-bot over 6 years ago
Likely to cause new Flow errors:
require
call (use import type
instead)Array.of
stricter (thanks @wchargin!)New Features:
{| |}
as a subtype of { +p?: T }
[[call]]
syntax in objects and interfacesflow find-refs
commandNotable bug fixes:
Misc:
--check
flag to flow ast
commandfilter
property to CanvasRenderingContext2D
libdeftimingSafeEqual
method to node crypto module (thanks @n-johnson!)Parser:
Decorator
node, matching estreePublished by facebook-github-bot over 6 years ago
Likely to cause new Flow errors:
$ObjMap
is used on an exact type).New Features:
Notable bug fixes:
Misc:
ps
.max_literal_length
option to .flowconfig
which replaces a magic constant.find-refs
now supports class instances.find-refs
on ES6 named exports to improve reliability.react-dom/server
libdef.Clients.matchAll
to return an Array
rather than an Iterator
.Parser:
Likely to cause new Flow errors:
New Features:
var foo: interface { x: string } = bar;
). Will be particularly useful in the future when we revamp object typesNotable bug fixes:
flow find-refs
threw an exception when used with an unchecked file. Now it treats the file as if it were checked, like other single-file commands doflow type-at-pos
now returns the class name for declare class
declarations.Misc:
.mjs
to the list of extensions that Flow reads by defaultflow find-refs --multi-hop
now parallelizes the work and is much fasterflow find-refs
and flow get-def
with destructuring patterns as a starting locationflow find-refs
with default
(as in export default ...
) as a starting locationflow find-refs
would miss certain locationsflow get-def
when used for default and named importsParser:
Likely to cause new Flow errors:
$Exact<empty>
as empty
. Before, ({p:0}:$Exact<empty>)
was not an error due to$Either<T>
, $All<T>
and $Type<T>
types are not supported any more.New Features:
multi-hop
mode was added that determines when object types are related through subtypingFunction.prototype.bind
as a proto field.*
a deprecated type, under the deprecated-type
strict flag.--expand-json-output
to print an extended JSON output for type-at-pos
.onclose
to the IDBDatabase
interface in lib/indexeddb.js
onmessageerror
to Worker
interface and fixed type of MessagePort.onmessage
lib/bom.js
.swap64()
to the Buffer
type and a Buffer
property in lib/node.js
.Intl
objects for the built-in JS language API (ECMA-402 - Internationalization API).uniform**v
setters in lib/dom.js
.Notable bug fixes:
Misc:
Object
type, "Flow for Atom IDE" in Atom plugins, Flow Strictnonstrict-import
lint rule.ocamlbuild
).WebGLRenderingContext#is*
methods to all return booleans.src/server
directory.$Subtype
and $Supertype
"unclear" types when not in a library context.type-at-pos
now prints types at the client-side.Parser:
??
(as above).+
or static
inside an object type{+}
) are now disallowed.proto
modifier in declare class, to specify that the property is[[new]]
).f<T>(x)
.Published by facebook-github-bot over 6 years ago
Likely to cause new Flow errors:
number
rather than a literal type. This has been fixed.module
and exports
. The disallowed patterns include computed propertymodule
and/or exports
.
experimental.well_formed_exports=true
is specified in.flowconfig
.New Features:
Fragment
has been added to the default exports of the React
libdef.find-refs
on a property key in a type declaration will now also yield that key in@flow strict-local
. This mode is the same as @flow strict
, except it@flow strict
is still the recommended mode, but@flow strict-local
allows enabling strict checking for files before all dependencies can be made@flow strict-local
file can be upgraded to a@flow strict
file. A @flow strict
file cannot depend on a @flow strict-local
file.esproposal.optional_chaining=enable
in your .flowconfig
.
Notable bug fixes:
estree_translator
properly handles all cases of the DeclareClass
AST node.suggest
command has been fixed to work with the new type normalizer.Misc:
find-refs
.Parser:
OptionalMember
and OptionalCall
nodes instead of the existingMember
and Call
nodes, and parentheses now correctly limit the scope of short-circuiting.Published by facebook-github-bot over 6 years ago
Likely to cause new Flow errors:
Promise
libdefs for the cases where null
or void
is passed as callbacks to then
catch
caused us to miss type errors. These libdefs have now been made stricter.this
parameters.typeof
with speculative typechecking would lead to missed errors, which will nowmodule
and exports
.API changes:
--json-version 2
includes a breaking change, affecting the "context"New Features:
createContext
and createRef
APIs introduced in ReactNotable bug fixes:
Misc:
type-at-pos
and friends, including converting normalized types back tofind-refs
.Array<T>
instead of T[]
.Parser:
implements
and mixins
fields of the DeclareClass
AST node.tokens
option to JS API: flow.parse(..., { tokens: true })
will now return the tokenflow ast --tokens
does.Notable bug fixes:
flow status
to throw an exceptionMisc:
Likely to cause new Flow errors:
Previously, Flow would allow you to write if (foo.unknownProp) { ... }
.
Now Flow disallows testing unknown properties in conditionals. If foo
is a
union type like { x: string } | { y: number }
, x
and y
are known
properties and z
would be an unknown property
New Features:
Notable bug fixes:
Misc:
declare var exports
, long deprecatedPublished by facebook-github-bot over 6 years ago
Likely to cause new Flow errors:
any
-typed API definitions with actual types. This may cause errors in code that uses those APIs.New Features:
find-refs
now has support for object type properties.Notable bug fixes:
find-refs
can now find identifiers used as JSX component classes (e.g. <Foo/>
).type-at-pos
).Misc:
type-at-pos
on method calls that have been affected by type refinements.--profile
flag to flow force-recheck
.--retry-if-init false
.type-at-pos
location for opaque type declarations.flow status
output when the server is in lazy mode.ReactDOM.hydrate()
.process.umask
's argument optional.Parser:
find-refs
from experimental to beta.find-refs
performance by 2x-20x depending on the workload.find-refs
.find-refs
.type-at-pos
and coverage
thanks to a type "normalizer" rewrite. Notably, the normalizer and client services like type-at-pos
now:
any
no longer completely resolve to any
. This may uncover new bugs in your programs where some inferred types silently resolved to any
.({...null}: {p: number});
incorrectly passed Flow. If you were spreading a maybe-object type then Flow may catch some new bugs in your programs.suppress_comment
) will become unused since error locations moved.nonstrict-import
lint's error message.React.cloneElement
for stateless functional components.--max-warnings
flag which allows Flow to exit with a non-zero exit code if warnings are present.--file-watcher
flag to ignore file system events.url.format
's urlObj
argument type.Improved inference of const
bindings (let
s and var
s that are never reassigned), and introduced similar inference for function params. This allows Flow to be less pessimistic about refinements, especially inside closures. For example:
function f(val) {
if (val == null) return () => 42;
return () => val; // OK, since val cannot be null
}
implements
now works on declare class
in addition to class
declare module
library definitions are now considered @flow strict
@flow strict
import rule when in a cycletype-at-pos
and coverage
commands when they encounter Object.prototype
and Function.prototype
merge_timeout
.flowconfig option to mirror the --merge-timeout
CLI flag added in 0.64implements
to DeclareClass
nodesLikely to cause new Flow errors:
event
is no longer recognized as a pre-declared globalNotable bug fixes:
Performance improvements:
Misc:
Parser:
Published by facebook-github-bot almost 7 years ago
Bug fix:
flow init
, which was generated an invalid .flowconfig
Published by facebook-github-bot almost 7 years ago
Likely to cause new Flow errors:
const
declare var exports: T
is deprecated in favor of declare module.exports: T
Notable bug fixes:
any
. This avoids cascading internal errors.Misc:
flow get-def
(used by IDEs for jump to definition) now behaves differently for variables introduced by an import
or require()
. Previously, it would show where the variable was created, in the import. Now it looks through the import and shows where the variable was exported.Parser:
static
in object typesPublished by facebook-github-bot almost 7 years ago