1、报错信息如下
2、源码理解
export declare type InputProps = Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, 'maxLength' | 'autoComplete' | 'enterKeyHint' | 'pattern' | 'type' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect'> & {
value?: string;
defaultValue?: string;
onChange?: (val: string) => void;
placeholder?: string;
disabled?: boolean;
readOnly?: boolean;
clearable?: boolean;
onClear?: () => void;
id?: string;
} & NativeProps<'--font-size' | '--color' | '--placeholder-color' | '--disabled-color'>;
React.InputHTMLAttributes在React中声名如下
type DetailedHTMLProps<E extends HTMLAttributes<T>, T> = ClassAttributes<T> & E;
3、解决方案
react声明文件版本过低,缺少下面声明