types: exports watch api types (#562)

This commit is contained in:
Yang Mingshan 2019-12-31 00:19:57 +08:00 committed by Evan You
parent f8b7ad5a77
commit 3980ad65de

View File

@ -45,9 +45,9 @@ export interface WatchOptions {
onTrigger?: ReactiveEffectOptions['onTrigger'] onTrigger?: ReactiveEffectOptions['onTrigger']
} }
type StopHandle = () => void export type StopHandle = () => void
type WatcherSource<T = any> = Ref<T> | ComputedRef<T> | (() => T) export type WatcherSource<T = any> = Ref<T> | ComputedRef<T> | (() => T)
type MapSources<T> = { type MapSources<T> = {
[K in keyof T]: T[K] extends WatcherSource<infer V> ? V : never [K in keyof T]: T[K] extends WatcherSource<infer V> ? V : never
@ -55,7 +55,7 @@ type MapSources<T> = {
export type CleanupRegistrator = (invalidate: () => void) => void export type CleanupRegistrator = (invalidate: () => void) => void
type SimpleEffect = (onCleanup: CleanupRegistrator) => void export type SimpleEffect = (onCleanup: CleanupRegistrator) => void
const invoke = (fn: Function) => fn() const invoke = (fn: Function) => fn()