fix(types): unwrap refs on public instance data (#3319)

fix #3315
This commit is contained in:
HcySunYang
2021-03-26 05:30:10 +08:00
committed by GitHub
parent 44166b43d9
commit 2b588cf1bc
4 changed files with 9 additions and 5 deletions

View File

@@ -25,7 +25,8 @@ export {
markRaw,
toRaw,
ReactiveFlags,
DeepReadonly
DeepReadonly,
UnwrapNestedRefs
} from './reactive'
export {
computed,

View File

@@ -57,7 +57,7 @@ function getTargetType(value: Target) {
}
// only unwrap nested ref
type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRef<T>
export type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRef<T>
/**
* Creates a reactive copy of the original object.

View File

@@ -20,7 +20,8 @@ import {
ReactiveFlags,
track,
TrackOpTypes,
ShallowUnwrapRef
ShallowUnwrapRef,
UnwrapNestedRefs
} from '@vue/reactivity'
import {
ExtractComputedReturns,
@@ -195,7 +196,7 @@ export type ComponentPublicInstance<
): WatchStopHandle
} & P &
ShallowUnwrapRef<B> &
D &
UnwrapNestedRefs<D> &
ExtractComputedReturns<C> &
M &
ComponentCustomProperties