Ila*_*ang 2 javascript reactjs flowtype react-native
示例 https://github.com/facebook/react-native/blob/master/Examples/UIExplorer/PanResponderExample.js#L41
var PanResponderExample = React.createClass({
...
circle: (null : ?{ setNativeProps(props: Object): void })
...
Run Code Online (Sandbox Code Playgroud)
我不知道这是什么意思 circle: (null : ?{ setNativeProps(props: Object): void })
谢谢你的建议.
类型转换特别适用于检查假设并帮助Flow推断您想要的类型.这里有些例子:
Run Code Online (Sandbox Code Playgroud)(x: number) // Make Flow check that x is a number (0: ?number) // Tells Flow that this expression is actually nullable. (null: ?number) // Tells Flow that this expression is a nullable number.
那么circle: (null : ?{ setNativeProps(props: Object): void })mean circle属性是一个可以为空的对象,它有一个setNativeProps方法,默认值是null.
| 归档时间: |
|
| 查看次数: |
206 次 |
| 最近记录: |