We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select 组件定制回填内容,在TypeScript下报错
the Select component has errors in TypeScript
<Select placeholder="Please select store" optionLabelProp="label" style={{ width: "100%" }} > {items.map(item => ( // got an error for label attribute <Option key={item} value={item} label={item}> <div> <Avatar style={{ background: "#10899e" }}>{item[0]}</Avatar>{" "} {item} </div> </Option> ))} </Select>
antd/lib/select/index.d.ts OptionProps 缺少 label参数
antd/lib/select/index.d.ts OptionProps missing label param
export interface OptionProps { disabled?: boolean; value?: string | number; title?: string; children?: React.ReactNode; className?: string; style?: React.CSSProperties; // label: string (missing) }
const Option: React.ClassicComponentClass
不能将类型“{ children: Element; key: string; value: string; label: string; }”分配给类型“IntrinsicAttributes & IntrinsicClassAttributes<Component<OptionProps, any, any>> & Readonly & Readonly<{ children?: ReactNode; }>”. 类型“IntrinsicAttributes & IntrinsicClassAttributes<Component<OptionProps, any, any>> & Readonly & Readonly<{ children?: ReactNode; }>”上不存在属性“label”。ts(2322)
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
https://codesandbox.io/s/vibrant-grass-yrj8i
Duplicate of #17493
No branches or pull requests
Reproduction link
Steps to reproduce
Select 组件定制回填内容,在TypeScript下报错
the Select component has errors in TypeScript
What is expected?
antd/lib/select/index.d.ts OptionProps 缺少 label参数
antd/lib/select/index.d.ts OptionProps missing label param
What is actually happening?
const Option: React.ClassicComponentClass
不能将类型“{ children: Element; key: string; value: string; label: string; }”分配给类型“IntrinsicAttributes & IntrinsicClassAttributes<Component<OptionProps, any, any>> & Readonly & Readonly<{ children?: ReactNode; }>”.
类型“IntrinsicAttributes & IntrinsicClassAttributes<Component<OptionProps, any, any>> & Readonly & Readonly<{ children?: ReactNode; }>”上不存在属性“label”。ts(2322)
The text was updated successfully, but these errors were encountered: