From ebe27295dfee4fee0610563efe3c7fefca0a5d67 Mon Sep 17 00:00:00 2001 From: Alexander Sheboltaev Date: Sat, 11 Feb 2017 18:25:17 +0700 Subject: [PATCH] typings: type-checking WatchHandler -- refining --- types/test/vue-test.ts | 4 +++- types/vue.d.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/test/vue-test.ts b/types/test/vue-test.ts index 3955a0c15..e2f6f38c3 100644 --- a/types/test/vue-test.ts +++ b/types/test/vue-test.ts @@ -1,6 +1,8 @@ import Vue = require("../index"); class Test extends Vue { + a: number; + testProperties() { this.$data; this.$el; @@ -37,7 +39,7 @@ class Test extends Vue { immediate: true, deep: false })(); - this.$watch(() => {}, (val: number) => {}); + this.$watch(() => this.a, (val: number) => {}); this.$on("", () => {}); this.$once("", () => {}); this.$off("", () => {}); diff --git a/types/vue.d.ts b/types/vue.d.ts index 0b96830d0..b8e32dd35 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -55,7 +55,7 @@ export declare class Vue { options?: WatchOptions ): (() => void); $watch( - expOrFn: () => T, + expOrFn: (this: this) => T, callback: WatchHandler, options?: WatchOptions ): (() => void);