简体   繁体   English

typescript:“从不”类型上不存在属性“标签”

[英]typescript: Property 'label' does not exist on type 'never'

How can fix this error:如何修复此错误:

Property 'label' does not exist on type 'never' “从不”类型上不存在属性“标签”

  <Picker
        dropdownIconColor='black'
        mode="dropdown">
        {stateList.map(option => <Picker.Item label={option.label} key={option.key} value={option.value} />)}
      </Picker>

The useState hook is used as follows in Typescript: useState 钩子在 Typescript 中使用如下:

//react javascript
const [wearablesList, setWearablesList] = useState([]);

//react typescript
interface Provider {
  connected: boolean;
  type: string;
}
const [wearablesList, setWearablesList] = useState<Provider[]>([]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM