【发布时间】:2017-07-27 09:47:24
【问题描述】:
我有一个 React 函数式组件,它以 List 作为道具。
const Dashboard = (props: { items: List } = { items: List() }) => {
const { items } = props
...
})
但是,const { items } = props 中的 items 会产生以下错误:
error 'items' is missing in props validation react/prop-types
FlowType docs举个例子:
ES2015 特性 分配给参数的默认值必须在后面 参数的类型注解:
函数 foo (P1: T1 = V): U { .. }
但我不太清楚这如何应用于对象
【问题讨论】:
标签: javascript eslint flowtype static-typing