Repository navigation
Conversation
…value A select callback only receives an option's value, never the null of an empty field. Typing the handlers from the field value forced consumers to assert whenever the field path ran through a nullable parent. Handlers now receive the element type of the non-null field value; value and onChange keep the field type. 🤖 Generated with Claude Code
There was a problem hiding this comment.
🟡 Changes recommended
The select callback typing incorrectly retains string[] for nullable scalar-or-array fields, rejecting valid string-only onSelect and onDeselect handlers.
1 open issue
What changed in this PR
This PR refines SelectField callback types so selection handlers use an individual selected value rather than the nullable field value.
Changes:
- Adds
SelectedValueto derive callback value types. - Redeclares
onSelectandonDeselectwhile preserving the field types forvalueandonChange.
| File | Description |
|---|---|
src/Fields/SelectField.tsx |
Introduces selected-value typing for selection and deselection callbacks. |
Review effort: Balanced
…rray types 🤖 Generated with Claude Code
|
🎉 This PR is included in version 21.1.1-alpha.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🤖 Generated with Claude Code
|
🎉 This PR is included in version 21.1.1-alpha.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

SelectFieldtypedonSelectandonDeselectby the field value.When the field path runs through a nullable parent, that value is
Array<string> | null, so handlers receivedstring | nulland consumers had to assert, although a select callback only ever receives an option's value.Both handlers now receive the element type of the non-null field value,
stringin the example.valueandonChangekeep the field type.Handlers that accept wider types, such as
string | null, still compile.For agents 🤖: ready for review, nothing pending
Only
src/Fields/SelectField.tsxchanged:onSelect/onDeselectare omitted fromSelectPropsand redeclared asSelectHandler<SelectedValue<TFieldValue>, TOption>.yarn typecheckand eslint on the file pass.A temporary usage with a nullable parent confirmed
(v: string) => …compiles after the change and failed before.The handler type derives from the field value rather than
TOption['value'], because the default option value type includesnumber | null, which would break existingstringhandlers.🤖 Generated with Claude Code