fix (types): do not unwrap refs in toRefs (#4966)
This commit is contained in:
@@ -190,9 +190,7 @@ export function customRef<T>(factory: CustomRefFactory<T>): Ref<T> {
|
||||
}
|
||||
|
||||
export type ToRefs<T = any> = {
|
||||
// #2687: somehow using ToRef<T[K]> here turns the resulting type into
|
||||
// a union of multiple Ref<*> types instead of a single Ref<* | *> type.
|
||||
[K in keyof T]: T[K] extends Ref ? T[K] : Ref<UnwrapRef<T[K]>>
|
||||
[K in keyof T]: ToRef<T[K]>
|
||||
}
|
||||
export function toRefs<T extends object>(object: T): ToRefs<T> {
|
||||
if (__DEV__ && !isProxy(object)) {
|
||||
|
||||
Reference in New Issue
Block a user