Replies: 1 comment
-
It should accept null most likely when we complete the typescript strict mode work. Edit, looks like we've completed ts strict mode for Radio. We probably just don't run strict mode on the docs examples yet. This is your context, and RadioGroupState is correct, as is null, because ReactContext must take a default value. https://react.dev/reference/react/createContext#parameters This is the type we've used in our component implementation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have the same question that this person has:
https://stackoverflow.com/questions/69165955/argument-of-type-null-is-not-assignable-to-parameter-of-type-radiogroupstate
Following the provided example: https://react-spectrum.adobe.com/react-aria/useRadioGroup.html
Users will end up with an error:
It seems that one or the other is needed:
useRadio
must accept state asnull
@react-stately/radio
must provide a method to create initialRadioGroupState
I've considered just casting the type, i.e.
but that's far from ideal since we are partially losing type safety.
I've also considered typing out the initial state myself, i.e.
but that's far from ideal as well because it keeps changing between versions.
Beta Was this translation helpful? Give feedback.
All reactions