react-component / react-component/field-form

使用control放开自定义组件依赖时TS检测存在问题

Open
#252 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1k
Forks
286
Avg merge
4d 16h
Merged PRs (30d)
1

Description

自定义组件如果参数设置为必传会报 Property 'params' is missing in type '{}' but required in type 相关错误

代码:

<Field
  name='params'
  rules={[{ required: true, message: '请填写}]}
>
  {(control, meta) => {
    return (
      <ICell error={meta.errors.length > 0}>
        <IRange type='time' maxLength={2} {...control} />
      </ICell>
    )
  }}
</Field>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named in the issue. Start by reproducing the shown Field, control, and IRange example with TypeScript checking enabled, then trace the custom-component dependency types involved. Done means the required params error no longer appears for this usage while required parameters remain checked.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.