From 7d68bf7b3861839421b2c0f8597b4a2e1b02fd0a Mon Sep 17 00:00:00 2001 From: pickchen Date: Wed, 17 Jun 2020 16:33:36 +0800 Subject: [PATCH] refactor(types): simplified UnwrapRef --- packages/reactivity/src/ref.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/reactivity/src/ref.ts b/packages/reactivity/src/ref.ts index d22e6a0e969..285a9937df7 100644 --- a/packages/reactivity/src/ref.ts +++ b/packages/reactivity/src/ref.ts @@ -2,7 +2,6 @@ import { track, trigger } from './effect' import { TrackOpTypes, TriggerOpTypes } from './operations' import { isObject, hasChanged } from '@vue/shared' import { reactive, isProxy, toRaw } from './reactive' -import { ComputedRef } from './computed' import { CollectionTypes } from './collectionHandlers' declare const RefSymbol: unique symbol @@ -157,9 +156,9 @@ type BaseTypes = string | number | boolean */ export interface RefUnwrapBailTypes {} -export type UnwrapRef = T extends ComputedRef +export type UnwrapRef = T extends Ref ? UnwrapRefSimple - : T extends Ref ? UnwrapRefSimple : UnwrapRefSimple + : UnwrapRefSimple type UnwrapRefSimple = T extends | Function