Adds static typing to JavaScript to improve developer productivity and code quality.
MIT License
Bot releases are visible (Hide)
Published 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 about 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 parametersPublished by mroch over 9 years ago
Published by gabelevi over 9 years ago
Likely to cause new Flow errors:
A.foo()
returns a Promise
, and module B requires A and calls A.foo()
, the return type of A.foo()
was not being checked properly)Object<K, V>
errorsnull
and undefined
)New features:
for-of
and support for Iterable
interface(s)async
/await
typeof x
, where x
is the name of an in-scope variablesuppress_comment
, a regexp which matches against comments and causes any Flow error on the next line to be suppressed. For example, suppress_comment=.*\$FlowFixMe.*
will cause /* $FlowFixMe */\nvar x : number = "oops";
to not raise an error.module.name_mapper
, a regexp -> replacement template tuple to be applied to any matching module names before the Flow system resolves the name and looks it up--color=always|never|auto
CLI option, useful when piping to less -R
--one-line
CLI option which replaces \n
with \\n
in multiline error messages, useful when piping to grep
Misc:
export default class
if (x instanceof Array)
x && y
when x
is an array, object or functionflow get-def
command, especially around imported types==
and improved comparison-related error messageslog.file
which overrides the default log file pathPublished by gabelevi over 9 years ago
any
to workaround things that you want to fix later? Well, now you can use $FixMe
instead of any
and easily grep for these workarounds later.require()
'ing/import
'ingflow check --traces N
, where N
is the trace depthObject.freeze()
Published by gabelevi over 9 years ago
Published by gabelevi over 9 years ago
Published by gabelevi over 9 years ago
Published by gabelevi over 9 years ago
for_type
valuePublished by gabelevi over 9 years ago
Published by jeffmo over 9 years ago
x != undefined
and x != null
as the same refinementPublished by gabelevi over 9 years ago