【发布时间】:2017-09-21 04:19:03
【问题描述】:
有没有办法在DefinitelyTyped 中为新的props 声明新类型?我在SelectField 组件中用一些新的props 更新了material-ui,但是DefinitelyTyped 中的输入是旧的。我可以以某种方式扩展SelectField 类型并添加新的props 类型吗?现在我有:
<SelectField
multiple={true}
hintText="Select type"
value={[...this.state.values]}
onChange={this.onChange}
selectionRenderer={this.selectionRenderer}
>
我需要添加multiple?: boolean 和selectionRenderer: (values: any[]) => string 类型。我尝试declare module 'material-ui/SelectField' {},但它不起作用。有任何想法吗?
【问题讨论】:
标签: reactjs typescript material-ui typescript-typings definitelytyped