Skip to content

Commit ebe2729

Browse files
ashebyyx990803
authored andcommitted
typings: type-checking WatchHandler -- refining
1 parent c662fe0 commit ebe2729

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

types/test/vue-test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Vue = require("../index");
22

33
class Test extends Vue {
4+
a: number;
5+
46
testProperties() {
57
this.$data;
68
this.$el;
@@ -37,7 +39,7 @@ class Test extends Vue {
3739
immediate: true,
3840
deep: false
3941
})();
40-
this.$watch(() => {}, (val: number) => {});
42+
this.$watch(() => this.a, (val: number) => {});
4143
this.$on("", () => {});
4244
this.$once("", () => {});
4345
this.$off("", () => {});

types/vue.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export declare class Vue {
5555
options?: WatchOptions
5656
): (() => void);
5757
$watch<T>(
58-
expOrFn: () => T,
58+
expOrFn: (this: this) => T,
5959
callback: WatchHandler<this, T>,
6060
options?: WatchOptions
6161
): (() => void);

0 commit comments

Comments
 (0)