If you come to JavaScript from other programming languages you are familiar with types. You have types in JavaScript too, but you do not have to specify these types when declaring variables, receiving arguments etc. This is one of the things that makes JavaScript great, but at the same time not so great.
如果你是从其他你更熟悉类型的编程语言转到 JavaScript 的,那么,你也可以在 JavaScript 中使用类型,不过你不需要在声明变量或者接收参数的时候指定类型。这可以让你的代码更加优雅,但是不是最优雅的。
Specifically when working on very large projects with many developers type checking gives stability to your project, much like a good test does. So using Flow is definitely not a requirement. It is for developers who depends on type checking as more of a routine and for the before mentioned large projects with many developers. Webpack makes it easy to include Flow in your workflow.
具体来说,当你在一个大项目中和很多开发者一起工作的时候,类型检查对你的项目来讲是保证了稳定性,就像一个很好的测试做的事情。所以使用 Flow 当然不是必要条件。对于那些需要和很多开发者一起做大项目的开发者来说类型检测是一种非常寻常的事。Webpack 引入 Flow 之后会非常方便。
安装 flow
- 还没尝试:)
- 尝试一下 "flowcheck-loader"? https://www.npmjs.com/package/flowcheck-loader (还没用过:))
- https://tryflow.org/