更新时间:2022-04-27 03:57:37
差不多。
()=> void
是一个不返回任何内容的函数的Flow注释( undefined
,又名 void 0
) 。
() => void
is Flow's annotation for a function that returns nothing (undefined
, aka void 0
).
中的主要问号?MyType
是Flow表达可空类型的方式。
The leading question mark in ?MyType
is Flow's way of expressing a nullable type.
所以在这种情况下 configureStore
接受一个名为 onComplete
的参数,它必须是null或不返回任何内容的函数。
So in this case configureStore
accepts one argument called onComplete
that must be either null or a function that returns nothing.
Flow不会为 onComplete 添加默认值或强制它方式因为与typescript不同,Flow不会生成任何新的JS代码。在运行时,所有Flow注释都被剥离以获得vanilla JS,就是这样。
Flow will not add a default value for onComplete
or coerce it in any way because unlike typescript, Flow does not generate any new JS code. At runtime, all Flow annotations are stripped to get vanilla JS, and that's that.