resolveUnref

Commons
stable

Unwrap a Vue Ref or a getter function to its current value. Functions are called; Refs are unwrapped via Vue unref. Useful for composables that accept either form.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

r
required
Ref | (() => unknown)
A Vue Ref (unwrapped via unref) or a zero-argument getter function (called directly). The two forms are interchangeable from the caller perspective.

API

Return value

The value returned by this util.

The current underlying value — equivalent to ref.value for a Ref, or fn() for a getter function.

Usage

Examples

Ready-to-paste usage snippets.

Unwrap a ref and a getter function

typescript