Flow is a static typechecker for JavaScript. To find out more about Flow, check out flow.org.
For a background on the project, please read this overview.
- Requirements
- Using Flow
- Using Flow's parser from JavaScript
- Building Flow from source
- Join the Flow community
- License
Flow works with:
- macOS
- Linux (64-bit)
- Windows (64-bit, Windows 10 recommended)
There are binary distributions for each of these platforms and you can also build it from source on any of them as well.
Check out the installation instructions, and then how to get started.
While Flow is written in OCaml, its parser is available as a compiled-to-JavaScript module published to npm, named flow-parser. Most end users of Flow will not need to use this parser directly, but JavaScript packages which make use of parsing Flow-typed JavaScript can use this to generate Flow's syntax tree with annotated types attached.
Flow is written in OCaml (OCaml 4.07.1 is required).
- Install
opam
:
- Mac:
brew install opam
- Debian:
sudo apt-get install opam
- Other Linux: see opam docs
- Windows: see OCaml for Windows docs
- Initialize
opam
:
opam init
- Install OCaml and Flow's dependencies:
# from within this git checkout
opam switch create . --deps-only -y
- Build the
flow
binary:
eval $(opam env)
make
This produces the bin/flow
binary.
- Build
flow.js
(optional):
opam install -y js_of_ocaml.3.4.0
make js
This produces bin/flow.js
.
The Flow parser can also be compiled to JavaScript. Read how here.
To run the tests, first compile flow using make
. Then run bash ./runtests.sh bin/flow
There is a make test
target that compiles and runs tests.
To run a subset of the tests you can pass a second argument to the runtests.sh
file.
For example: bash runtests.sh bin/flow class | grep -v 'SKIP'
- Website: https://flow.org
- Discord: https://discord.gg/8ezwRUK
- irc: #flowtype on Freenode
- Twitter: follow @flowtype and #flowtype to keep up with the latest Flow news.
- Stack Overflow: Ask a question with the flowtype tag
Flow is MIT-licensed (LICENSE). The website and documentation are licensed under the Creative Commons Attribution 4.0 license (website/LICENSE-DOCUMENTATION).