فهرست منبع

types: improve type 'Ref' (#105)

扩散性百万甜面包 6 سال پیش
والد
کامیت
5c1e42f754
1فایلهای تغییر یافته به همراه3 افزوده شده و 6 حذف شده
  1. 3 6
      packages/reactivity/src/computed.ts

+ 3 - 6
packages/reactivity/src/computed.ts

@@ -1,16 +1,13 @@
 import { effect, ReactiveEffect, activeReactiveEffectStack } from './effect'
-import { UnwrapNestedRefs } from './ref'
+import { Ref, UnwrapNestedRefs } from './ref'
 import { isFunction } from '@vue/shared'
 
-export interface ComputedRef<T> {
-  _isRef: true
+export interface ComputedRef<T> extends Ref<T> {
   readonly value: UnwrapNestedRefs<T>
   readonly effect: ReactiveEffect
 }
 
-export interface WritableComputedRef<T> {
-  _isRef: true
-  value: UnwrapNestedRefs<T>
+export interface WritableComputedRef<T> extends Ref<T> {
   readonly effect: ReactiveEffect
 }