react-component / react-component/input-number

不能将类型 SetStateAction<number> 分配给类型 (value: number | null) => void

Open
#511 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
323
Forks
188
Avg merge
20h 3m
Merged PRs (30d)
1

Description

onChange 的改动是否是破坏性改动?
const [val, setVal] = useState(0) <InputNumber val={val} onChange={setVal} />
造成了大面积编译不过

inputnumber

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

Start by inspecting the InputNumber onChange type and reproducing the shown useState example with TypeScript. Compare the current callback signature with React's SetStateAction; done when the intended compatibility behavior is established and the issue's breaking-change question is resolved.

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.