File tree Expand file tree Collapse file tree 6 files changed +41
-10
lines changed Expand file tree Collapse file tree 6 files changed +41
-10
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ declare interface Component {
69
69
_vnode: ?VNode ;
70
70
_staticTrees: ?Array < VNode > ;
71
71
_hasHookEvent: boolean ;
72
+ _provided: ?Object ;
72
73
73
74
// private methods
74
75
// lifecycle
Original file line number Diff line number Diff line change @@ -24,30 +24,44 @@ declare type ComponentOptions = {
24
24
cache ?: boolean
25
25
}
26
26
} ;
27
- methods ?: {
28
- [ key : string ] : Function
29
- } ;
30
- watch ?: {
31
- [ key : string ] : Function | string
32
- } ;
27
+ methods ?: { [ key : string ] : Function } ;
28
+ watch ?: { [ key : string ] : Function | string } ;
29
+
33
30
// DOM
34
31
el ?: string | Element ;
35
32
template ?: string ;
36
33
render : ( h : ( ) => VNode ) => VNode ;
37
34
renderError ?: ( h : ( ) => VNode , err : Error ) => VNode ;
38
35
staticRenderFns ?: Array < ( ) => VNode > ;
36
+
39
37
// lifecycle
40
38
beforeCreate ?: Function ;
41
39
created ?: Function ;
42
40
beforeMount ?: Function ;
43
41
mounted ?: Function ;
44
42
beforeUpdate ?: Function ;
45
43
updated ?: Function ;
44
+ activated ?: Function ;
45
+ deactivated ?: Function ;
46
+ beforeDestroy ?: Function ;
47
+ destroyed ?: Function ;
48
+
46
49
// assets
47
50
directives ?: { [ key : string ] : Object } ;
48
51
components ?: { [ key : string ] : Class < Component > } ;
49
52
transitions ?: { [ key : string ] : Object } ;
50
53
filters ?: { [ key : string ] : Function } ;
54
+
55
+ // context
56
+ provide ?: Object | ( ) => Object ;
57
+ inject ?: { [ key : string ] : string } | Array < string > ;
58
+
59
+ // component v-model customization
60
+ model ?: {
61
+ prop ?: string ;
62
+ event ?: string ;
63
+ } ;
64
+
51
65
// misc
52
66
parent ?: Component ;
53
67
mixins ?: Array < Object > ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export type Config = {
9
9
productionTip: boolean ;
10
10
performance: boolean ;
11
11
devtools: boolean ;
12
- errorHandler: ?Function ;
12
+ errorHandler: ?( err : Error , vm : Component , info : string ) => void ;
13
13
ignoredElements: Array < string > ;
14
14
keyCodes: { [ key : string ] : number } ;
15
15
// platform
Original file line number Diff line number Diff line change 1
- export function initInjections ( vm ) {
2
- const { provide, inject } = vm . $options
1
+ /* @flow */
2
+
3
+ export function initInjections ( vm : Component ) {
4
+ const provide = vm . $options . provide
5
+ const inject : any = vm . $options . inject
3
6
if ( provide ) {
4
7
vm . _provided = typeof provide === 'function'
5
8
? provide . call ( vm )
6
9
: provide
7
10
}
8
11
if ( inject ) {
12
+ // inject is :any because flow is not smart enough to figure out cached
13
+ // isArray here
9
14
const isArray = Array . isArray ( inject )
10
15
const keys = isArray ? inject : Object . keys ( inject )
11
16
for ( let i = 0 ; i < keys . length ; i ++ ) {
Original file line number Diff line number Diff line change @@ -40,6 +40,14 @@ export interface ComponentOptions<V extends Vue> {
40
40
transitions ?: { [ key : string ] : Object } ;
41
41
filters ?: { [ key : string ] : Function } ;
42
42
43
+ provide ?: Object | ( ( ) => Object ) ;
44
+ inject ?: { [ key : string ] : string } | Array < string > ;
45
+
46
+ model ?: {
47
+ prop ?: string ;
48
+ event ?: string ;
49
+ } ;
50
+
43
51
parent ?: Vue ;
44
52
mixins ?: ( ComponentOptions < Vue > | typeof Vue ) [ ] ;
45
53
name ?: string ;
Original file line number Diff line number Diff line change @@ -71,7 +71,10 @@ export declare class Vue {
71
71
silent : boolean ;
72
72
optionMergeStrategies : any ;
73
73
devtools : boolean ;
74
- errorHandler ( err : Error , vm : Vue ) : void ;
74
+ productionTip : boolean ;
75
+ performance : boolean ;
76
+ errorHandler ( err : Error , vm : Vue , info : string ) : void ;
77
+ ignoredElements : string [ ] ;
75
78
keyCodes : { [ key : string ] : number } ;
76
79
}
77
80
You can’t perform that action at this time.
0 commit comments