ant-design-vue/components/_util/hooks/_vueuse/resolveUnref.ts

10 lines
248 B
TypeScript
Raw Normal View History

2022-11-07 05:42:51 +00:00
import { unref } from 'vue';
import type { MaybeComputedRef } from './types';
/**
* Get the value of value/ref/getter.
*/
export function resolveUnref<T>(r: MaybeComputedRef<T>): T {
return typeof r === 'function' ? (r as any)() : unref(r);
}