RA-OSS-20 - Some Inputs with choices in their props do not accept ReadonlyArray<T>#9162
RA-OSS-20 - Some Inputs with choices in their props do not accept ReadonlyArray<T>#9162gitstart wants to merge 6 commits intomarmelab:masterfrom
Conversation
Co-authored-by: passy4ucj <ojinnnakapascal@gmail.com> Co-authored-by: gitstart_bot <gitstart_bot@users.noreply.github.com>
Co-authored-by: passy4ucj <ojinnnakapascal@gmail.com> Co-authored-by: GitStart <1501599+gitstart@users.noreply.github.com> Co-authored-by: gitstart_bot <gitstart_bot@users.noreply.github.com>
Co-authored-by: Azerii <32432927+Azerii@users.noreply.github.com>
|
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 <32432927+Azerii@users.noreply.github.com>
|
@slax57 we tried another fix can you check it out. |
|
Sorry it took us so long to review this. This looks good to me. Could you merge the latest changes from |
slax57
left a comment
There was a problem hiding this comment.
This PR does not seem to fix the issue it's supposed to address.
slax57
left a comment
There was a problem hiding this comment.
UPDATE: my bad, I forgot to build ra-core first
Fixes #9155
This code was written and reviewed by GitStart Community. Growing great engineers, one PR at a time.