fix(watch): type inference for computed refs

This commit is contained in:
Evan You
2019-10-14 12:15:09 -04:00
parent 6bd26636c3
commit 6b3ad95fa4
2 changed files with 14 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ import {
stop,
isRef,
Ref,
ComputedRef,
ReactiveEffectOptions
} from '@vue/reactivity'
import { queueJob } from './scheduler'
@@ -32,7 +33,7 @@ export interface WatchOptions {
type StopHandle = () => void
type WatcherSource<T = any> = Ref<T> | (() => T)
type WatcherSource<T = any> = Ref<T> | ComputedRef<T> | (() => T)
type MapSources<T> = {
[K in keyof T]: T[K] extends WatcherSource<infer V> ? V : never