|
|
@@ -1,3 +1,4 @@
|
|
|
+import type { ComputedRef } from './computed'
|
|
|
import {
|
|
|
activeEffect,
|
|
|
getDepFromReactive,
|
|
|
@@ -210,7 +211,7 @@ export type MaybeRefOrGetter<T = any> = MaybeRef<T> | (() => T)
|
|
|
* @param ref - Ref or plain value to be converted into the plain value.
|
|
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#unref}
|
|
|
*/
|
|
|
-export function unref<T>(ref: MaybeRef<T>): T {
|
|
|
+export function unref<T>(ref: MaybeRef<T> | ComputedRef<T>): T {
|
|
|
return isRef(ref) ? ref.value : ref
|
|
|
}
|
|
|
|
|
|
@@ -230,7 +231,7 @@ export function unref<T>(ref: MaybeRef<T>): T {
|
|
|
* @param source - A getter, an existing ref, or a non-function value.
|
|
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#tovalue}
|
|
|
*/
|
|
|
-export function toValue<T>(source: MaybeRefOrGetter<T>): T {
|
|
|
+export function toValue<T>(source: MaybeRefOrGetter<T> | ComputedRef<T>): T {
|
|
|
return isFunction(source) ? source() : unref(source)
|
|
|
}
|
|
|
|