6
6
WatchOptions ,
7
7
WatchHandler ,
8
8
DirectiveOptions ,
9
- DirectiveFunction
9
+ DirectiveFunction ,
10
10
} from "./options" ;
11
11
import { VNode , VNodeData , VNodeChildren , ScopedSlot } from "./vnode" ;
12
12
import { PluginFunction , PluginObject } from "./plugin" ;
@@ -28,17 +28,17 @@ export type CreateElement = {
28
28
( tag : AsyncComponent , data ?: VNodeData , children ?: VNodeChildren ) : VNode ;
29
29
}
30
30
31
- export declare class Vue {
32
-
33
- constructor ( options ?: ComponentOptions < Vue > ) ;
31
+ interface AnyVue extends Vue < any , any , any > {
32
+ }
34
33
35
- $data : Object ;
34
+ export interface Vue < Data , Methods , Computed > {
35
+ $data : Data ;
36
36
readonly $el : HTMLElement ;
37
- readonly $options : ComponentOptions < this > ;
38
- readonly $parent : Vue ;
39
- readonly $root : Vue ;
40
- readonly $children : Vue [ ] ;
41
- readonly $refs : { [ key : string ] : Vue | Element | Vue [ ] | Element [ ] } ;
37
+ readonly $options : ComponentOptions < Data , Methods , Computed > ;
38
+ readonly $parent : AnyVue ;
39
+ readonly $root : AnyVue ;
40
+ readonly $children : AnyVue [ ] ;
41
+ readonly $refs : { [ key : string ] : AnyVue | Element | AnyVue [ ] | Element [ ] } ;
42
42
readonly $slots : { [ key : string ] : VNode [ ] } ;
43
43
readonly $scopedSlots : { [ key : string ] : ScopedSlot } ;
44
44
readonly $isServer : boolean ;
@@ -51,12 +51,12 @@ export declare class Vue {
51
51
$delete : typeof Vue . delete ;
52
52
$watch (
53
53
expOrFn : string ,
54
- callback : WatchHandler < this , any > ,
54
+ callback : WatchHandler < any > ,
55
55
options ?: WatchOptions
56
56
) : ( ( ) => void ) ;
57
57
$watch < T > (
58
58
expOrFn : ( this : this) => T ,
59
- callback : WatchHandler < this , T > ,
59
+ callback : WatchHandler < T > ,
60
60
options ?: WatchOptions
61
61
) : ( ( ) => void ) ;
62
62
$on ( event : string | string [ ] , callback : Function ) : this;
@@ -66,36 +66,42 @@ export declare class Vue {
66
66
$nextTick ( callback : ( this : this) => void ) : void ;
67
67
$nextTick ( ) : Promise < void > ;
68
68
$createElement : CreateElement ;
69
+ }
69
70
70
- static config : {
71
- silent : boolean ;
72
- optionMergeStrategies : any ;
73
- devtools : boolean ;
74
- productionTip : boolean ;
75
- performance : boolean ;
76
- errorHandler ( err : Error , vm : Vue , info : string ) : void ;
77
- ignoredElements : string [ ] ;
78
- keyCodes : { [ key : string ] : number } ;
79
- }
71
+ export interface VueConstructor {
72
+ new < Data , Methods , Computed > ( options ?: ComponentOptions < Data , Methods & ThisType < Data & Methods & Computed > , Computed > & ThisType < Data & Methods & Computed > ) : Data & Methods & Computed & Vue < Data , Methods , Computed > ;
80
73
81
- static extend ( options : ComponentOptions < Vue > | FunctionalComponentOptions ) : typeof Vue ;
82
- static nextTick ( callback : ( ) => void , context ?: any [ ] ) : void ;
83
- static nextTick ( ) : Promise < void >
84
- static set < T > ( object : Object , key : string , value : T ) : T ;
85
- static set < T > ( array : T [ ] , key : number , value : T ) : T ;
86
- static delete ( object : Object , key : string ) : void ;
74
+ extend < V , Data , Methods , Computed > ( this : V , options : ComponentOptions < Data , Methods , Computed > | FunctionalComponentOptions ) : ( ( ... args : any [ ] ) => Vue < Data , Methods , Computed > ) & V ;
75
+ nextTick ( callback : ( ) => void , context ?: any [ ] ) : void ;
76
+ nextTick ( ) : Promise < void >
77
+ set < T > ( object : Object , key : string , value : T ) : T ;
78
+ set < T > ( array : T [ ] , key : number , value : T ) : T ;
79
+ delete ( object : Object , key : string ) : void ;
87
80
88
- static directive (
81
+ directive (
89
82
id : string ,
90
83
definition ?: DirectiveOptions | DirectiveFunction
91
84
) : DirectiveOptions ;
92
- static filter ( id : string , definition ?: Function ) : Function ;
93
- static component ( id : string , definition ?: Component | AsyncComponent ) : typeof Vue ;
85
+ filter ( id : string , definition ?: Function ) : Function ;
86
+ component ( id : string , definition ?: Component | AsyncComponent ) : typeof Vue ;
94
87
95
- static use < T > ( plugin : PluginObject < T > | PluginFunction < T > , options ?: T ) : void ;
96
- static mixin ( mixin : typeof Vue | ComponentOptions < Vue > ) : void ;
97
- static compile ( template : string ) : {
88
+ use < T > ( plugin : PluginObject < T > | PluginFunction < T > , options ?: T ) : void ;
89
+ mixin ( mixin : typeof Vue | ComponentOptions < any , any , any > ) : void ;
90
+ compile ( template : string ) : {
98
91
render ( createElement : typeof Vue . prototype . $createElement ) : VNode ;
99
92
staticRenderFns : ( ( ) => VNode ) [ ] ;
100
93
} ;
94
+
95
+ config : {
96
+ silent : boolean ;
97
+ optionMergeStrategies : any ;
98
+ devtools : boolean ;
99
+ productionTip : boolean ;
100
+ performance : boolean ;
101
+ errorHandler ( err : Error , vm : AnyVue , info : string ) : void ;
102
+ ignoredElements : string [ ] ;
103
+ keyCodes : { [ key : string ] : number } ;
104
+ }
101
105
}
106
+
107
+ export const Vue : VueConstructor ;
0 commit comments