File tree 2 files changed +24
-0
lines changed
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1
1
import {
2
2
h ,
3
3
defineComponent ,
4
+ DefineComponent ,
4
5
ref ,
5
6
Fragment ,
6
7
Teleport ,
@@ -231,3 +232,18 @@ describe('resolveComponent should work', () => {
231
232
message : '1'
232
233
} )
233
234
} )
235
+
236
+ // #5431
237
+ describe ( 'h should work with multiple types' , ( ) => {
238
+ const serializers = {
239
+ Paragraph : 'p' ,
240
+ Component : { } as Component ,
241
+ DefineComponent : { } as DefineComponent
242
+ }
243
+
244
+ const sampleComponent = serializers [ '' as keyof typeof serializers ]
245
+
246
+ h ( sampleComponent )
247
+ h ( sampleComponent , { } )
248
+ h ( sampleComponent , { } , [ ] )
249
+ } )
Original file line number Diff line number Diff line change @@ -174,6 +174,14 @@ export function h<P>(
174
174
children ?: RawChildren | RawSlots
175
175
) : VNode
176
176
177
+ // catch all types
178
+ export function h ( type : string | Component , children ?: RawChildren ) : VNode
179
+ export function h < P > (
180
+ type : string | Component < P > ,
181
+ props ?: ( RawProps & P ) | ( { } extends P ? null : never ) ,
182
+ children ?: RawChildren | RawSlots
183
+ ) : VNode
184
+
177
185
// Actual implementation
178
186
export function h ( type : any , propsOrChildren ?: any , children ?: any ) : VNode {
179
187
const l = arguments . length
You can’t perform that action at this time.
0 commit comments