File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -137,12 +137,14 @@ interface FooProps {
137
137
value ?: string
138
138
'onUpdate:value' ?: ( value : string ) => void
139
139
slots : {
140
+ default ( name : string ) : VNodeChild
140
141
item ( ) : VNodeChild
141
142
}
142
143
}
143
144
144
145
class Foo extends VueComponent < FooProps > {
145
146
render ( ) {
147
+ this . context . slots . default ?.( 'aaa' )
146
148
return undefined
147
149
}
148
150
}
Original file line number Diff line number Diff line change @@ -27,15 +27,23 @@ export interface Hanlder {
27
27
handler : ( targetThis : any ) => void
28
28
}
29
29
30
+ type DefaultSlots = {
31
+ default ( ) : VNodeChild
32
+ }
33
+
34
+ type MixDefaultSlots < T extends { } > = 'default' extends keyof T ? { } : DefaultSlots
35
+
30
36
// 处理tsx slots 类型问题
31
37
export type WithVSlots < T extends { } > = {
32
38
'v-slots' ?: 'slots' extends keyof T
33
- ? Partial < T [ 'slots' ] & { $stable : boolean ; default ( ) : VNodeChild } >
39
+ ? Partial < T [ 'slots' ] & { $stable : boolean } & MixDefaultSlots < T [ 'slots' ] > >
34
40
: Partial < { $stable : boolean ; default ( ) : VNodeChild } >
35
41
}
36
42
37
43
export type WithSlotTypes < T extends { } > = Omit < SetupContext , 'slots' > & {
38
- slots : 'slots' extends keyof T ? Partial < T [ 'slots' ] & { default ( ) : VNodeChild } > : Partial < { default ( ) : VNodeChild } >
44
+ slots : 'slots' extends keyof T
45
+ ? Partial < T [ 'slots' ] & MixDefaultSlots < T [ 'slots' ] > >
46
+ : Partial < { default ( ) : VNodeChild } >
39
47
}
40
48
41
49
type ModelProps < T extends { } > = Exclude <
You can’t perform that action at this time.
0 commit comments