import { watchEffect, shallowRef } from 'vue'; import type { ComputedRef } from 'vue'; export declare type ComputedGetter = (...args: any[]) => T; export default function eagerComputed(fn: ComputedGetter) { const result = shallowRef(); watchEffect( () => { result.value = fn(); }, { flush: 'sync', // needed so updates are immediate. }, ); return result as any as ComputedRef; }