1
1
import { Vue } from "./vue.d" ;
2
- import { VNode , VNodeDirective } from "./vnode.d" ;
2
+ import { VNode , VNodeData , VNodeDirective } from "./vnode.d" ;
3
3
4
4
type Constructor = {
5
5
new ( ...args : any [ ] ) : any ;
6
6
}
7
7
8
+ type $createElement = typeof Vue . prototype . $createElement ;
9
+
8
10
export interface ComponentOptions {
9
11
data ?: Object | ( ( this : Vue ) => Object ) ;
10
12
props ?: string [ ] | { [ key : string ] : PropOptions | Constructor | Constructor [ ] } ;
@@ -15,7 +17,7 @@ export interface ComponentOptions {
15
17
16
18
el ?: Element | String ;
17
19
template ?: string ;
18
- render ?( createElement : typeof Vue . prototype . $createElement ) : VNode ;
20
+ render ?( createElement : $createElement ) : VNode ;
19
21
staticRenderFns ?: ( ( ) => VNode ) [ ] ;
20
22
21
23
beforeCreate ?( ) : void ;
@@ -28,7 +30,7 @@ export interface ComponentOptions {
28
30
updated ?( ) : void ;
29
31
30
32
directives ?: { [ key : string ] : DirectiveOptions | DirectiveFunction } ;
31
- components ?: { [ key : string ] : ComponentOptions | typeof Vue } ;
33
+ components ?: { [ key : string ] : ComponentOptions | FunctionalComponentOptions | typeof Vue } ;
32
34
transitions ?: { [ key : string ] : Object } ;
33
35
filters ?: { [ key : string ] : Function } ;
34
36
@@ -39,6 +41,21 @@ export interface ComponentOptions {
39
41
delimiters ?: [ string , string ] ;
40
42
}
41
43
44
+ export interface FunctionalComponentOptions {
45
+ props ?: string [ ] | { [ key : string ] : PropOptions | Constructor | Constructor [ ] } ;
46
+ functional : boolean ;
47
+ render ( this : never , createElement : $createElement , context : RenderContext ) : VNode ;
48
+ name ?: string ;
49
+ }
50
+
51
+ export interface RenderContext {
52
+ props : any ;
53
+ children : VNode [ ] ;
54
+ slots : any ;
55
+ data : VNodeData ;
56
+ parent : Vue ;
57
+ }
58
+
42
59
export interface PropOptions {
43
60
type ?: Constructor | Constructor [ ] | null ;
44
61
required ?: boolean ;
0 commit comments