radix-vue icon indicating copy to clipboard operation
radix-vue copied to clipboard

feat(Combobox): narrow modelValue as readonly array type

Open unrevised6419 opened this issue 1 year ago • 2 comments

When a readonly array is passed as modelValue, it will error. This change will arrow a readonly array as modelValue. Internally Combobox modelValue is immutable.

Type 'readonly Option<T>[]' is not assignable to type 'Option<T> | Option<T>[] | undefined'.ts-plugin(2322)

unrevised6419 avatar Jul 30 '24 13:07 unrevised6419

@iamandrewluca what's the reason you are passing readonly to modelValue?

zernonia avatar Aug 10 '24 03:08 zernonia

I try to keep my code as immutable and static as possible. I was looking through Combobox internals, and all the code is not doing any mutations to the state itself.

unrevised6419 avatar Aug 12 '24 05:08 unrevised6419

We try to keep the types as close to the v-model's types from Vue, so this addition might not be inline with the idea

zernonia avatar Aug 19 '24 08:08 zernonia

I see 🤔 in this case, I will close the PR. Sorry for the inconvenience, and thanks for your attention.

unrevised6419 avatar Aug 19 '24 08:08 unrevised6419