Не могли бы вы помочь мне понять и исправить ошибку
Я использую машинописный текст, webpack, redux-form.
Когда я запускаю webpack-dev-server --mode development, у меня возникает ошибка компиляции.
Он был скомпилирован, но я удалил папку node_modules и ее yarn install. yarn.lock не удалялся.
InputField.ts
import React from 'react';
import {WrappedFieldProps} from 'redux-form';
interface IProps {
label: string,
}
const InputField: React.FC<WrappedFieldProps & IProps> = ({
label,
}) => {
return (
<div className = "form-control">
<label>
{label}:
</label>
</div>
);
};
export default InputField;
в форме компонента
import InputField from 'Field/InputField';
render() {
return (
<form onSubmit = {handleSubmit}>
<Field
component = {InputField}
name = "email"
label = "E-mail"
/>
ошибка
TS2322: Type 'FunctionComponent<WrappedFieldProps & IProps>' is not assignable to type '("input" & FunctionComponent<WrappedFiel
dProps & IProps>) | ("select" & FunctionComponent<WrappedFieldProps & IProps>) | ("textarea" & FunctionComponent<WrappedFieldProps & I
Props>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & FunctionComponent<...>)'.
Type 'FunctionComponent<WrappedFieldProps & IProps>' is not assignable to type '"input" & FunctionComponent<WrappedFieldProps & IPro
ps>'.
Type 'FunctionComponent<WrappedFieldProps & IProps>' is not assignable to type '"input"'.






Определите компонент как
const InputField = (props: WrappedFieldProps & IProps) => {
ИМХО, похоже, есть проблема с @ typings / redux-form
Попробуй npm удалить redux-form npm установить redux-form