export type AutoRef = [T] extends [(...args: any[]) => any] ? Ref | (() => T) : T | Ref | (() => T) /** * Accepts a value directly, a ref with the value or a getter function and returns a Vue ref. * @param value The value to use. * @returns Either the original or newly created ref. */ export function useAutoRef(value: AutoRef): Ref { if (typeof value === 'function') return computed(() => value()) return isRef(value) ? value : ref(value as any) }