feat(reactivity): expose unref and shallowRef

This commit is contained in:
Evan You
2020-02-22 04:39:32 +01:00
parent 0c67201942
commit e9024bf1b7
6 changed files with 59 additions and 11 deletions

View File

@@ -1,6 +1,5 @@
import { expectType } from 'tsd'
import { Ref, ref } from './index'
import { isRef } from '@vue/reactivity'
import { Ref, ref, isRef, unref } from './index'
function foo(arg: number | Ref<number>) {
// ref coercing
@@ -11,6 +10,9 @@ function foo(arg: number | Ref<number>) {
if (isRef(arg)) {
expectType<Ref<number>>(arg)
}
// ref unwrapping
expectType<number>(unref(arg))
}
foo(1)