react-component / react-component/select

onSelect和onDeselect什么时候参数会是option对象

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

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
938
Forks
482
Avg merge
15h 8m
Merged PRs (30d)
2

Description

看到 https://github.com/react-component/select/blob/master/src/Select.tsx#L112-L113 的参数类型在近期修改成了RawValueType | LabelInValueType,我们使用过程中有遇到tsc检查出来的类型不兼容问题

从文档来看,似乎onSelectonDeselect的参数只能是value而不会是option对象:

image

想了解一下,如果这个类型的更新是正确的,那么什么情况下value参数的值会是LabelInValueType类型,便于用户做好相应的逻辑处理

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 with src/Select.tsx around lines 112-113 and compare the callback parameter types with the documented onSelect and onDeselect behavior. Check the relevant type definitions and existing tests or examples to identify when LabelInValueType is expected; done means the typing and documentation agree and the reported tsc incompatibility is addressed.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.