import { expectType } from 'tsd' import { Ref, ref, isRef, unref } from './index' function foo(arg: number | Ref) { // ref coercing const coerced = ref(arg) expectType>(coerced) // isRef as type guard if (isRef(arg)) { expectType>(arg) } // ref unwrapping expectType(unref(arg)) // ref inner type should be unwrapped const nestedRef = ref({ foo: ref(1) }) expectType>(nestedRef) expectType<{ foo: number }>(nestedRef.value) } foo(1)