add module augmentation test (#3713)

This commit is contained in:
katashin 2016-09-22 01:45:40 +09:00 committed by Evan You
parent 4785afd154
commit 019d90040d
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,35 @@
import Vue = require("../index");
declare module "../vue" {
// add instance property and method
interface Vue {
$instanceProperty: string;
$instanceMethod(): void;
}
// add static property and method
namespace Vue {
const staticProperty: string;
function staticMethod(): void;
}
}
// augment ComponentOptions
declare module "../options" {
interface ComponentOptions<V extends Vue> {
foo?: string;
}
}
const vm = new Vue({
data: {
a: true
},
foo: "foo"
});
vm.$instanceProperty;
vm.$instanceMethod();
Vue.staticProperty;
Vue.staticMethod();

View File

@ -14,7 +14,8 @@
"../vue.d.ts",
"options-test.ts",
"plugin-test.ts",
"vue-test.ts"
"vue-test.ts",
"augmentation-test.ts"
],
"compileOnSave": false
}