* fix(types): make `toRef` return correct type(fix #4732) * chore: use correct test Co-authored-by: Evan You <yyx990803@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
toRef,
|
||||
toRefs,
|
||||
ToRefs,
|
||||
shallowReactive,
|
||||
watch
|
||||
} from './index'
|
||||
|
||||
@@ -236,3 +237,15 @@ function testUnrefGenerics<T>(p: T | Ref<T>) {
|
||||
}
|
||||
|
||||
testUnrefGenerics(1)
|
||||
|
||||
// #4732
|
||||
const baz = shallowReactive({
|
||||
foo: {
|
||||
bar: ref(42)
|
||||
}
|
||||
})
|
||||
|
||||
const foo = toRef(baz, 'foo')
|
||||
|
||||
expectType<Ref<number>>(foo.value.bar)
|
||||
expectType<number>(foo.value.bar.value)
|
||||
|
||||
Reference in New Issue
Block a user