File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import Vue = require( "../index" ) ;
2+
3+ declare module "../vue" {
4+ // add instance property and method
5+ interface Vue {
6+ $instanceProperty : string ;
7+ $instanceMethod ( ) : void ;
8+ }
9+
10+ // add static property and method
11+ namespace Vue {
12+ const staticProperty : string ;
13+ function staticMethod ( ) : void ;
14+ }
15+ }
16+
17+ // augment ComponentOptions
18+ declare module "../options" {
19+ interface ComponentOptions < V extends Vue > {
20+ foo ?: string ;
21+ }
22+ }
23+
24+ const vm = new Vue ( {
25+ data : {
26+ a : true
27+ } ,
28+ foo : "foo"
29+ } ) ;
30+
31+ vm . $instanceProperty ;
32+ vm . $instanceMethod ( ) ;
33+
34+ Vue . staticProperty ;
35+ Vue . staticMethod ( ) ;
Original file line number Diff line number Diff line change 1414 " ../vue.d.ts" ,
1515 " options-test.ts" ,
1616 " plugin-test.ts" ,
17- " vue-test.ts"
17+ " vue-test.ts" ,
18+ " augmentation-test.ts"
1819 ],
1920 "compileOnSave" : false
2021}
You can’t perform that action at this time.
0 commit comments