我是React的新手,并从tslint遇到警告,说“阴影名称:'props'(无阴影变量)tslint(1)”。我真的无法解决这个问题,因此我真的需要您的帮助。
return (
<DropdownMenuPortal
children={children}
anchorEl={anchorEl}
container={document.body}
isOpen={menuIsOpen}
/>
);
},
ValueContainer: this.ValueContainer,
MultiValue: this.MultiValue,
SingleValue: this.SingleValue,
Placeholder: this.Placeholder,
Control: this.Control,
**//Here I have that issue**
Menu: (**props**: MenuProps<OptionType> & { innerProps: { onMouseDown(): void } }) => {
const {
selectProps: { options, filterOption, inputValue },
children,
getValue,
setValue,
innerProps: { onMouseDown },
} = props;
const value = getValue() as OptionsType<OptionType>;
const showSelectAllBtn = value.length < options.length;
const showClearAllBtn = !!value.length;
const onSelectAll = () => {
const filteredOptions = options.filter(option =>
filterOption(option as any, inputValue)
);
setValue([...value, ...filteredOptions], setValueAction);
};
答案 0 :(得分:0)
出现警告是因为您多次重新定义了相同的变量。
如果您确实需要关闭此警告,请将其添加到您的tslint规则中:
"rules": {
"no-shadowed-variable": false
}