diff --git a/types/options.d.ts b/types/options.d.ts index f49ca085e4e..323c7630986 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -76,7 +76,7 @@ export interface ComponentOptions< propsData?: object; computed?: Accessors; methods?: Methods; - watch?: Record | WatchHandler | string>; + watch?: Record | WatchHandler>; el?: Element | string; template?: string; @@ -169,7 +169,7 @@ export interface ComputedOptions { cache?: boolean; } -export type WatchHandler = (val: T, oldVal: T) => void; +export type WatchHandler = string | ((val: T, oldVal: T) => void); export interface WatchOptions { deep?: boolean; diff --git a/types/test/options-test.ts b/types/test/options-test.ts index fb06abb583b..024916b4a70 100644 --- a/types/test/options-test.ts +++ b/types/test/options-test.ts @@ -168,6 +168,10 @@ Vue.component('component', { this.a = val }, deep: true + }, + d: { + handler: 'someMethod', + immediate: true } }, el: "#app",