Javascript语法null:?{}

Javascript语法null:?{},javascript,reactjs,react-native,flowtype,Javascript,Reactjs,React Native,Flowtype,榜样 我不知道它是什么意思circle:(null:?{setNativeProps(props:Object):void}) 谢谢你的建议。这是打字,你可以在这里看到更多细节 类型转换对于检查假设和帮助Flow推断您想要的类型特别有用。以下是一些例子: (x: number) // Make Flow check that x is a number (0: ?number) // Tells Flow that this expression is actually nullabl

榜样

我不知道它是什么意思
circle:(null:?{setNativeProps(props:Object):void})

谢谢你的建议。

这是打字,你可以在这里看到更多细节

类型转换对于检查假设和帮助Flow推断您想要的类型特别有用。以下是一些例子:

  (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})
是指
circle
属性是一个可为null的对象,它有一个
setNativeProps
方法,默认值是
null

可能需要引用文章中最重要的部分。
  (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.