Skip to content
On this page

resolveRef

Category
Last Changed
2 weeks ago
Related

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

SourceDocs

Contributors

Anthony Fu

Changelog

v8.8.0 on 7/6/2022
29fd5 - feat: new function (#1743)
resolveRef has loaded