`$$()` on array from `defineProps` yields incorrect Typescript type
Vue version
3.2.37
Link to minimal reproduction
Steps to reproduce
Reproducing requires full IDE support, so copy the code into your IDE and observe that the type of someArrayRef
is Ref<string>[]
.
Attempting to send the value into a function expecting Ref<string[]>
yields the following error message:
Argument of type 'Ref<string>[]' is not assignable to parameter of type 'Ref<string[]>'.
What is expected?
Type of someArrayRef
should be Ref<string[]>
What is actually happening?
Type of someArrayRef
is Ref<string>[]
System Info
No response
Any additional comments?
I've seen a similar bug report in https://github.com/vuejs/core/issues/5976, but the suggested solution there doesn't seem to yield the same javascript output (and the expected reactivity is lost)
I cannot find a way to fix it, as it goes for
either $$([a, b])
(e.g. in watch
) mentioned in #5976
or the situation discussed above (to keep reactivity for values deconstructed from props
)
I tried to add another rule for Arrays
export declare function $$<T extends unknown[]>(value: T): Ref<T>
It does fix the problem here but breaks another one (in #5976)