File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -137,12 +137,14 @@ interface FooProps {
137137 value ?: string
138138 'onUpdate:value' ?: ( value : string ) => void
139139 slots : {
140+ default ( name : string ) : VNodeChild
140141 item ( ) : VNodeChild
141142 }
142143}
143144
144145class Foo extends VueComponent < FooProps > {
145146 render ( ) {
147+ this . context . slots . default ?.( 'aaa' )
146148 return undefined
147149 }
148150}
Original file line number Diff line number Diff line change @@ -27,15 +27,23 @@ export interface Hanlder {
2727 handler : ( targetThis : any ) => void
2828}
2929
30+ type DefaultSlots = {
31+ default ( ) : VNodeChild
32+ }
33+
34+ type MixDefaultSlots < T extends { } > = 'default' extends keyof T ? { } : DefaultSlots
35+
3036// 处理tsx slots 类型问题
3137export type WithVSlots < T extends { } > = {
3238 'v-slots' ?: 'slots' extends keyof T
33- ? Partial < T [ 'slots' ] & { $stable : boolean ; default ( ) : VNodeChild } >
39+ ? Partial < T [ 'slots' ] & { $stable : boolean } & MixDefaultSlots < T [ 'slots' ] > >
3440 : Partial < { $stable : boolean ; default ( ) : VNodeChild } >
3541}
3642
3743export 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 } >
3947}
4048
4149type ModelProps < T extends { } > = Exclude <
You can’t perform that action at this time.
0 commit comments