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