resolveRef
Normalize value/ref/getter to ref
or computed
.
Usage
import { resolveRef } from '@vueuse/core'
const foo = ref('hi')
const a = resolveRef(0) // Ref<number>
const b = resolveRef(foo) // Ref<string>
const c = resolveRef(() => 'hi') // ComputedRef<string>
import { resolveRef } from '@vueuse/core'
const foo = ref('hi')
const a = resolveRef(0) // Ref<number>
const b = resolveRef(foo) // Ref<string>
const c = resolveRef(() => 'hi') // ComputedRef<string>
Type Declarations
/**
* Normalize value/ref/getter to `ref` or `computed`.
*/
export declare function resolveRef<T>(r: MaybeComputedRef<T>): ComputedRef<T>
export declare function resolveRef<T>(r: MaybeRef<T>): Ref<T>
/**
* Normalize value/ref/getter to `ref` or `computed`.
*/
export declare function resolveRef<T>(r: MaybeComputedRef<T>): ComputedRef<T>
export declare function resolveRef<T>(r: MaybeRef<T>): Ref<T>
Source
Contributors
Anthony Fu