ref should not unwrap all properties of the entity type
Version
3.2.31
Reproduction link
Steps to reproduce
Reproduction link
What is expected?
ref should not unwrap all properties of the entity type
What is actually happening?
Reproduction link
You can use the RefUnwrapBailTypes
: https://github.com/vuejs/core/blob/main/packages/reactivity/src/ref.ts#L252-L269 to avoid unwrapping.
It can solve the tuple type recursion problem, but it is buggy in the source code. Hope you look at this line of code (https://github.com/vuejs/core/blob/main/packages/reactivity/src/ref.ts#L297), the extends ? :
evaluation is problematic, for all object
type is always true.
interface X {
a: 1
b: 2
c: 3
d: 4
}
// bug line: https://github.com/vuejs/core/blob/main/packages/reactivity/src/ref.ts#L297
type Unwrap<T> = T extends (object & { xx?: never }) ? true : false
{
type Test1 = Unwrap<X> // true
// ^?
type Test2 = Unwrap<X & { xx: never }> // true
// ^?
}
And a project defines many object
types, developers do not need to put all object types into RefUnwrapBailTypes