typings: type-checking WatchHandler -- refining

This commit is contained in:
Alexander Sheboltaev 2017-02-11 18:25:17 +07:00 committed by Evan You
parent c662fe09c7
commit ebe27295df
2 changed files with 4 additions and 2 deletions

View File

@ -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("", () => {});

2
types/vue.d.ts vendored
View File

@ -55,7 +55,7 @@ export declare class Vue {
options?: WatchOptions
): (() => void);
$watch<T>(
expOrFn: () => T,
expOrFn: (this: this) => T,
callback: WatchHandler<this, T>,
options?: WatchOptions
): (() => void);