-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RA-OSS-20 - Some Inputs with choices in their props do not accept ReadonlyArray<T> #9162
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: passy4ucj <[email protected]> Co-authored-by: gitstart_bot <[email protected]>
Co-authored-by: passy4ucj <[email protected]> Co-authored-by: GitStart <[email protected]> Co-authored-by: gitstart_bot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not fix the issue.
Tested in the simple example with a code adapted from the code given in #9155 , and I still see the error.
Co-authored-by: Azerii <[email protected]>
Thanks for this updated version. I must admit I'm a bit reluctant to accept this solution, because of all the An alternative solution, that would be cleaner IMO, would be to use generic types in this manner: interface ChoicesProps <T = any[]> {
choices?: T extends Array<any> ? T : T extends ReadonlyArray<any> ? T : "must be Array or ReadonlyArray";
} However this would also require propagating the type to inner layers of the code. So it may lead to many changed files... You can give it a try if you will, but I must remind that, for the reasons explained here, and because it is so easy to fix in user-land, we are not willing to invest too much time on resolving this issue in case it starts becoming too complex. |
Co-authored-by: Azerii <[email protected]>
@slax57 we tried another fix can you check it out. |
ISSUE
This code was written and reviewed by GitStart Community. Growing great engineers, one PR at a time.