@@ -28,6 +28,7 @@ import {
28
28
CreateComponentPublicInstance ,
29
29
ComponentPublicInstanceConstructor
30
30
} from './componentPublicInstance'
31
+ import { SlotsType } from './componentSlots'
31
32
32
33
export type PublicProps = VNodeProps &
33
34
AllowedComponentProps &
@@ -43,6 +44,7 @@ export type DefineComponent<
43
44
Extends extends ComponentOptionsMixin = ComponentOptionsMixin ,
44
45
E extends EmitsOptions = { } ,
45
46
EE extends string = string ,
47
+ S extends SlotsType = { } ,
46
48
PP = PublicProps ,
47
49
Props = Readonly <
48
50
PropsOrPropOptions extends ComponentPropsOptions
@@ -61,6 +63,7 @@ export type DefineComponent<
61
63
Mixin ,
62
64
Extends ,
63
65
E ,
66
+ S ,
64
67
PP & Props ,
65
68
Defaults ,
66
69
true
@@ -77,6 +80,7 @@ export type DefineComponent<
77
80
Extends ,
78
81
E ,
79
82
EE ,
83
+ S ,
80
84
Defaults
81
85
> &
82
86
PP
@@ -91,29 +95,33 @@ export type DefineComponent<
91
95
export function defineComponent <
92
96
Props extends Record < string , any > ,
93
97
E extends EmitsOptions = { } ,
94
- EE extends string = string
98
+ EE extends string = string ,
99
+ S extends SlotsType = { }
95
100
> (
96
101
setup : (
97
102
props : Props ,
98
- ctx : SetupContext < E >
103
+ ctx : SetupContext < E , S >
99
104
) => RenderFunction | Promise < RenderFunction > ,
100
105
options ?: Pick < ComponentOptions , 'name' | 'inheritAttrs' > & {
101
106
props ?: ( keyof Props ) [ ]
102
107
emits ?: E | EE [ ]
108
+ slots ?: S
103
109
}
104
110
) : ( props : Props & EmitsToProps < E > ) => any
105
111
export function defineComponent <
106
112
Props extends Record < string , any > ,
107
113
E extends EmitsOptions = { } ,
108
- EE extends string = string
114
+ EE extends string = string ,
115
+ S extends SlotsType = { }
109
116
> (
110
117
setup : (
111
118
props : Props ,
112
- ctx : SetupContext < E >
119
+ ctx : SetupContext < E , S >
113
120
) => RenderFunction | Promise < RenderFunction > ,
114
121
options ?: Pick < ComponentOptions , 'name' | 'inheritAttrs' > & {
115
122
props ?: ComponentObjectPropsOptions < Props >
116
123
emits ?: E | EE [ ]
124
+ slots ?: S
117
125
}
118
126
) : ( props : Props & EmitsToProps < E > ) => any
119
127
@@ -130,6 +138,7 @@ export function defineComponent<
130
138
Extends extends ComponentOptionsMixin = ComponentOptionsMixin ,
131
139
E extends EmitsOptions = { } ,
132
140
EE extends string = string ,
141
+ S extends SlotsType = { } ,
133
142
I extends ComponentInjectOptions = { } ,
134
143
II extends string = string
135
144
> (
@@ -143,10 +152,11 @@ export function defineComponent<
143
152
Extends ,
144
153
E ,
145
154
EE ,
155
+ S ,
146
156
I ,
147
157
II
148
158
>
149
- ) : DefineComponent < Props , RawBindings , D , C , M , Mixin , Extends , E , EE >
159
+ ) : DefineComponent < Props , RawBindings , D , C , M , Mixin , Extends , E , EE , S >
150
160
151
161
// overload 3: object format with array props declaration
152
162
// props inferred as { [key in PropNames]?: any }
@@ -161,6 +171,7 @@ export function defineComponent<
161
171
Extends extends ComponentOptionsMixin = ComponentOptionsMixin ,
162
172
E extends EmitsOptions = { } ,
163
173
EE extends string = string ,
174
+ S extends SlotsType = { } ,
164
175
I extends ComponentInjectOptions = { } ,
165
176
II extends string = string
166
177
> (
@@ -174,6 +185,7 @@ export function defineComponent<
174
185
Extends ,
175
186
E ,
176
187
EE ,
188
+ S ,
177
189
I ,
178
190
II
179
191
>
@@ -186,7 +198,8 @@ export function defineComponent<
186
198
Mixin ,
187
199
Extends ,
188
200
E ,
189
- EE
201
+ EE ,
202
+ S
190
203
>
191
204
192
205
// overload 4: object format with object props declaration
@@ -203,6 +216,7 @@ export function defineComponent<
203
216
Extends extends ComponentOptionsMixin = ComponentOptionsMixin ,
204
217
E extends EmitsOptions = { } ,
205
218
EE extends string = string ,
219
+ S extends SlotsType = { } ,
206
220
I extends ComponentInjectOptions = { } ,
207
221
II extends string = string
208
222
> (
@@ -216,10 +230,11 @@ export function defineComponent<
216
230
Extends ,
217
231
E ,
218
232
EE ,
233
+ S ,
219
234
I ,
220
235
II
221
236
>
222
- ) : DefineComponent < PropsOptions , RawBindings , D , C , M , Mixin , Extends , E , EE >
237
+ ) : DefineComponent < PropsOptions , RawBindings , D , C , M , Mixin , Extends , E , EE , S >
223
238
224
239
// implementation, close to no-op
225
240
export function defineComponent (
0 commit comments