阅读此处的一些代码:( redux organization ) 并注意到以下代码。
// todos/model.js
export type Todo = {
id?: number;
text: string;
completed: boolean;
};
// This is the model of our module state (e.g. return type of the reducer)
export type State = Todo[];
这看起来像 Flow代码,其中大部分是有道理的。但我有点不明白 Todo[] 上的空括号 是什么意思。
通常在 js 中你使用空括号来分配一个空数组。虽然我从来没有见过它这样使用。这是 Flow 功能吗?在文档中找不到它。
最佳答案
关于javascript - 访问流对象时使用空括号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37872178/