ant-design / ant-design/compatible

JSX element type 'FormItem' is not a constructor function for JSX elements.

Open
#40 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
93
Forks
29
PR merge metrics
No merged PRs in 30d

Description

react 16.13.1
@types/react 16.9.34

升级迁移 兼容V3时 Form & FormItem报错

// tsconfig
{
"compilerOptions": {
"baseUrl": "src",
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"experimentalDecorators": true,
"noImplicitThis": false
},
"include": [
"src"
],
"extends": "./paths.json"
}


{form.getFieldDecorator(`departmentIds[_${item}]`, {
rules: required === false ? [] : [{ required: true, message: '请选择部门' }],
initialValue: index < (departmentList || []).length ? initDepartmentObj[item] : undefined
})(
label.join(' - ')}
getPopupContainer={(triggerNode:{parentNode:React.ReactNode}) => triggerNode.parentNode}
{...rst}
/>
)}

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue provides a tsconfig and a LegacyForm.Item usage example, but names no source file or test. Start by reproducing the JSX type error with React 16.13.1 and @types/react 16.9.34, then trace the Form and FormItem compatibility path. Done means the migration example type-checks without the constructor-function error.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.