无法实例化 GetFormErrorInterface,因为 GetFormErrorInterface [1] 不是多态类型
Cannot instantiate GetFormErrorInterface because GetFormErrorInterface [1] is not a polymorphic type
我的代码工作正常,但是当我尝试从 state 获取 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│ 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
这是我的代码:
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
}
)
);
看起来很容易修复,但我不明白哪里出了问题,为什么我不能直接使用 GetFormError????请任何帮助。提前谢谢你
我的代码工作正常,但是当我尝试从 state 获取 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│ 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
这是我的代码:
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
}
)
);
看起来很容易修复,但我不明白哪里出了问题,为什么我不能直接使用 GetFormError????请任何帮助。提前谢谢你