[React Flow] Up and Running with Facebook Flow for Typed JavaScript

Install:

npm i -D flow-bin
npm i -g flow-bin

 

Init:

flow init

 

Script:

"typecheck": "flow src"

Check the src folder.

 

Add mark to the file which you want to check:

/*@flow */

 

function to be checked:

function add(x: number, y: number){

    return x + y;

}

add(1, '2');

 

When the flow runs, it will report the error because '2' we passed in is a string not a number.

 


 

Notic: Flow only works with Mac and Linux.

See more: Link

posted @ 2016-05-07 16:13  Zhentiw  阅读(190)  评论(0)    收藏  举报