码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2016-05-07 17:59:39      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:

Install:

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

 

Init:

flow init

 

Script:

"typecheck": "flow check 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

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

标签:

原文地址:http://www.cnblogs.com/Answer1215/p/5468554.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!