Reactjs 无法实例化GetFormErrorInterface,因为GetFormErrorInterface[1]不是多态类型
我的代码工作正常,但我在尝试从状态获取redux表单错误时遇到以下流错误:Reactjs 无法实例化GetFormErrorInterface,因为GetFormErrorInterface[1]不是多态类型,reactjs,redux,redux-form,flowtype,Reactjs,Redux,Redux Form,Flowtype,我的代码工作正常,但我在尝试从状态获取redux表单错误时遇到以下流错误: Cannot instantiate GetFormErrorInterface because GetFormErrorInterface [1] is not a polymorphic type. node_modules/redux-form/lib/index.js.flow 134│ 135│ declare export function getFormError( 136│ getFormS
Cannot instantiate GetFormErrorInterface because GetFormErrorInterface [1] is not a polymorphic type.
node_modules/redux-form/lib/index.js.flow
134│
135│ declare export function getFormError(
136│ getFormState: ?GetFormState
137│ ): GetFormErrorInterface<*>
138│
139│ declare export function getFormNames(
140│ getFormState: ?GetFormState
node_modules/redux-form/lib/selectors/getFormError.types.js.flow
[1] 2│ export type GetFormErrorInterface = (state: any) => any
无法实例化GetFormErrorInterface,因为GetFormErrorInterface[1]不是多态类型。
node_modules/redux form/lib/index.js.flow
134│
135│ 声明导出函数getFormError(
136│ getFormState:?getFormState
137│ ): GetFormErrorInterface
138│
139│ 声明导出函数getFormName(
140│ getFormState:?getFormState
node_modules/redux form/lib/selectors/getFormError.types.js.flow
[1] 2│ 导出类型GetFormErrorInterface=(状态:any)=>any
这是我的密码:
import { connect } from 'react-redux';
import { getFormError } from 'redux-form';
import { COMPACT_FORM_NAME } from '../data-layer/reviews/constants';
import {
checkReviewQualityAsync,
createReviewCompactAsync
} from '../data-layer/reviews/actions';
const enhance = compose(
withRouter,
connect(
(state: RootState) => ({
submitError: getFormError(COMPACT_FORM_NAME)(state),// << Here is the problem
}),
{
onCreateReview: createReviewCompactAsync,
onCheckReviewQuality: checkReviewQualityAsync
}
)
);
从'react redux'导入{connect};
从“redux表单”导入{getFormError};
从“../data layer/reviews/constants”导入{COMPACT_FORM_NAME}”;
进口{
checkReviewQualityAsync,
createReviewCompactAsync
}来自“../data layer/reviews/actions”;
常数增强=合成(
用路由器,
连接(
(状态:RootState)=>({
submitError:getFormError(COMPACT\u FORM\u NAME)(state),//您需要更新redux表单版本。请参阅