Adds static typing to JavaScript to improve developer productivity and code quality.
MIT License
Bot releases are hidden (Show)
Published by SamChou19815 4 months ago
Notable bug fixes:
flow force-recheck
doesn't respect files.implicitly_include_root=false
config.Published by SamChou19815 4 months ago
This release is used to test the release automation powered by GitHub Actions. No changes are expected.
Published by fishythefish almost 6 years ago
Likely to cause new Flow errors:
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 _
.$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.
React.StrictMode
type.flowtest
package. flowtest
is a CLI tool for running tests on Flow types.sharedmemory.heap_size
option.Notable bug fixes:
module.exports
objects.declare function
.type-at-pos
.flow suggest
no longer outputs <<anonymous class>>
.Remote
in type-at-pos
.Misc:
WeakMap
keys must now be objects.preserve_inferred_literal_types
is set. This does not change the behavior of type-at-pos
.experimental.cancelable_rechecks
option.Parser:
expression
field from Function
nodes in the AST.flow_parser.js
which should cause it to stack overflow in fewer cases.{}
instead of ;
in pretty mode.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.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 gabelevi over 7 years ago
Features:
Published by jeffmo over 7 years ago
Notable bug fixes:
React.createClass
components (including mixed in proptypes). This has been fix and may uncover new proptypes errors in createClass componentsfindDOMNode
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 codebasePublished by gabelevi over 8 years ago
Likely to cause new Flow errors:
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
.New features:
flow init
now has more command line flags to specify what should be in the created .flowconfig
flow ast
now can parse JSON files.flowconfig
files. Lines starting with #
or ;
are ignored[ignore]
section of a .flowconfig
you can now ignore a relative path with <PROJECT_ROOT>/path/to/ignored
flow
commands have an --ignore-version
flag to skip the version check specified in the .flowconfig
.module.use_strict
option to the .flowconfig
. When it is true, Flow will treat every file as if it has the "use strict";
directive.number
type into number literal types. (e.g. after x === 0
Flow now knows that x has the type 0
)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.!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>
esproposal.decorators
config option). Thanks @marudor!Notable bug fixes:
(obj: SomeClass)
except for when obj instanceof SomeClass
.flowconfig
all
flag to the .flowconfig
--strip-root
flag for displaying errorsasync
if (foo[0]) { ... }
, which should work like if (foo["prop"]) { ... }
does. That is, Flow should remember that foo[0]
exists and is truthy.Misc:
flow start --json
will start a server and output a JSON blob with info about the new serverObject.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.Published by jeffmo over 8 years ago
Likely to cause new Flow errors:
New features:
node_modules
dependency in the [ignore]
section of your .flowconfig
if you have a library definition defined for that dependency.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.@flow
pragma. We anticipate this will improve performance for projects with large, non-Flow node_modules directories.|
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:
obj['abc']
didn't behave quite the same as refining obj.abc
flow get-def
on the left-hand side of a require()
wouldn't hop through the require()
and to the actual location of the definitionimport type
to get a non-type exportflow dump-types --json
was not as robust as it could be against outputting valid JSON in the event of certain kinds of errorsdeclare class
declarations now properly define a built-in name
property (like real class declarations do)Published by gabelevi over 8 years ago
Likely to cause new Flow errors:
extends React.Component<DefaultProps, Props, void>
(previously it was extends React.Component<DefaultProps, Props, {}>)
state: State;
New features:
div
, span
, etc) and specify which properties they have.interface Generator<+Yield,+Return,-Next> {...}
. Still pending transpiler support though.string
and union types with string equality now properly refines the types.export * as
from @leebyron's Stage1 proposal. Babel support here
Notable bug fixes:
this
typethis
switch
statements with default
case.Misc:
Published by gabelevi almost 9 years ago
Bug fixes:
this
typeMisc:
Published by jeffmo almost 9 years ago
New features:
this
return type for class methodsimport typeof * as
now allows for concise access to the type of the ModuleNamespace objectrequire()
/import
a .json fileBug fixes:
declare type
wouldn't work in a declare module
that has an exports
entryFunction.prototype.bind
would lose the types of the params on the function it outputmodule.file_ext
would cause internal flow libs to be ignoredFunction
typesexport * from
(it should work fully now)Misc:
Function.prototype.{bind,call,apply}
import
statements where the remote exports don't exist (or may be typo'd)let
variablesflow get-def
will now hop through lvalues in variable assignments for more fine-grained "hop-tracing" of a variable back to its definitioncallable
signature can now be passed in to type positions that expect a function with a matching signaturePublished by gabelevi almost 9 years ago
Bug fix:
Published by gabelevi almost 9 years ago
Likely to cause new Flow errors:
@flow
files. Use @noflow
to work around thisimport type * as Foo
is now disallowed in favor of import type Foo
require()
can only take a string literalextends React.Component<void, Props, State>
(previously it was extends React.Component<{}, Props, State>)
static defaultProps: DefaultProps;
React.createClass()
react componentsin
keywordNew Features:
flow coverage
commandnull
type annotation.flowconfig
optionsfoo.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 fileNotable Bug Fixes:
Misc:
--root
arg to most client commandsflow get-def
: Jump to module named in import statementvar {x} = new Foo()
flow server
will write to log file in addition to stdout/stderrPublished by jeffmo almost 9 years ago
v0.18.1
Published by gabelevi about 9 years ago
New Features:
Notable Bug Fixes:
make
on OSX now works when lib/
files changereturn()
and throw()
methods are now supporteddefault
using named specifiers is now supportedFlow
now understands this
in class static methods and this.constructor
in class instance methods (thanks @popham!)name
propertyMisc:
flow find-module
Object
can now be called as a function to cast things to objectsPublished by jeffmo about 9 years ago
Likely to cause new Flow errors:
New Features:
mixins
on declare class
library definitionsNotable Bug Fixes:
Misc:
--traces
outputPublished by gabelevi about 9 years ago
Likely to cause new Flow errors:
this
before super()
in a derived constructor, per ES6 semanticsinterfaces
and declare class
. Now we are.New Features:
if(x.y[a.b])
export type {type1, type2}
syntaxNotable Bug Fixes:
T
or a Promise<T>
and it means the same thingMisc:
Published by gabelevi about 9 years ago
Likely to cause new Flow errors:
?string
and you assign 'hello' to it, Flow refines its type to 'string'.Likely to fix old Flow errors:
any
. For example, previously ReactElement
was treated as ReactElement<*, *, *>
. Now it's treated as ReactElement<any, any, any>
.Misc:
unsafe.enable_getters_and_setters
declare type
in lib filesPublished by jeffmo over 9 years ago
Likely to cause new Flow errors:
+
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.Misc:
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)flow ast
command to print a serialized JSON ESTree AST. (Note that this AST does not include types, just syntactic structure for now)export type
within a CommonJS module that also uses the module.exports = ...
patternundefined
to optional parameters