首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法实例化GetFormErrorInterface,因为GetFormErrorInterface [1]不是多态类型

无法实例化GetFormErrorInterface,因为GetFormErrorInterface [1]不是多态类型
EN

Stack Overflow用户
提问于 2019-09-15 14:12:51
回答 1查看 73关注 0票数 0

我的代码工作正常,但是当试图从state获得redux表单错误时,我会得到这个流错误:

代码语言:javascript
复制
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

这是我的代码:

代码语言:javascript
复制
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?请任何帮助。提前谢谢你

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-16 08:48:23

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57944923

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档