diff --git a/packages/reactivity/src/ref.ts b/packages/reactivity/src/ref.ts index 55059485d6c..4cafff4d7bb 100644 --- a/packages/reactivity/src/ref.ts +++ b/packages/reactivity/src/ref.ts @@ -5,6 +5,7 @@ import { isProxy, toRaw, isReactive, toReactive } from './reactive' import type { ShallowReactiveMarker } from './reactive' import { CollectionTypes } from './collectionHandlers' import { createDep, Dep } from './dep' +import { IfAny } from 'packages/runtime-core/src/helpers/typeUtils' declare const RefSymbol: unique symbol @@ -222,7 +223,8 @@ class ObjectRefImpl { } } -export type ToRef = [T] extends [Ref] ? T : Ref +export type ToRef = IfAny,[T] extends [Ref] ? T : Ref> + export function toRef( object: T,