types(reactivity): simplify UnwrapNestedRefs (#4194)
This commit is contained in:
parent
b79e4ca717
commit
da6c055b19
@ -11,7 +11,7 @@ import {
|
|||||||
shallowCollectionHandlers,
|
shallowCollectionHandlers,
|
||||||
shallowReadonlyCollectionHandlers
|
shallowReadonlyCollectionHandlers
|
||||||
} from './collectionHandlers'
|
} from './collectionHandlers'
|
||||||
import { UnwrapRef, Ref } from './ref'
|
import { UnwrapRefSimple, Ref } from './ref'
|
||||||
|
|
||||||
export const enum ReactiveFlags {
|
export const enum ReactiveFlags {
|
||||||
SKIP = '__v_skip',
|
SKIP = '__v_skip',
|
||||||
@ -60,7 +60,7 @@ function getTargetType(value: Target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// only unwrap nested ref
|
// only unwrap nested ref
|
||||||
export type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRef<T>
|
export type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a reactive copy of the original object.
|
* Creates a reactive copy of the original object.
|
||||||
|
@ -264,7 +264,7 @@ export type UnwrapRef<T> = T extends Ref<infer V>
|
|||||||
? UnwrapRefSimple<V>
|
? UnwrapRefSimple<V>
|
||||||
: UnwrapRefSimple<T>
|
: UnwrapRefSimple<T>
|
||||||
|
|
||||||
type UnwrapRefSimple<T> = T extends
|
export type UnwrapRefSimple<T> = T extends
|
||||||
| Function
|
| Function
|
||||||
| CollectionTypes
|
| CollectionTypes
|
||||||
| BaseTypes
|
| BaseTypes
|
||||||
|
Loading…
Reference in New Issue
Block a user