types(reactivity): simplify UnwrapNestedRefs (#4194)

This commit is contained in:
Pick 2021-07-28 23:15:08 +08:00 committed by GitHub
parent b79e4ca717
commit da6c055b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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.

View File

@ -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