Repository navigation
ref(scraps): Make radio group items type-safe - #130231
Merged
Merged
Conversation
Contributor
Story previewsPreview the stories changed in this PR on the Vercel deployment: Preview deployment: https://sentry-r26ejulq0.sentry.dev |
Contributor
decision-model-lintervoice
decision-model-linter: 73 calls on 11 files, 137,908 input tokens, $0.0058, model typesafe/jev-1.13-20260917 |
Contributor
📊 Type Coverage Diff✅ no issues found |
| children: (components: { | ||
| Item: (props: RadioItemProps<NoInfer<T>>) => React.JSX.Element; | ||
| }) => React.ReactNode; | ||
| onChange: (value: NoInfer<T>) => void; |
Member
There was a problem hiding this comment.
Nit: is NoInfer needed here? On TS 6 value already wins inference over onChange, and Item is only used inside the callback, so it can't widen T either way
Collaborator
Author
There was a problem hiding this comment.
it’s safer to infer from value only, e.g. if you have an onChange function that accepts a sub-set of values of a union
priscilawebdev
approved these changes
Nov 10, 2026
TkDodo
marked this pull request as ready for review
November 10, 2026 11:46
TkDodo
enabled auto-merge (squash)
November 10, 2026 11:48
skaasten
pushed a commit
that referenced
this pull request
Nov 12, 2026
master replaced field.Radio.Group and field.Radio.Item with the type-safe field.RadioGroup (#130231), so the project access radios move to it and pass field.handleChange directly.
2 tasks done
This branch was successfully 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.
field.RadioGroupinfers the allowedItemvalues and theonChangeargument from its selectedvalue. Invalid choices now fail type checking, and callers can passfield.handleChangewithout value casts.This replaces
field.Radio.Groupandfield.Radio.Item