Skip to content

Commit d3add06

Browse files
committed
fix(types): fix this.$slots type for defineComponent
1 parent 1d5a411 commit d3add06

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

types/test/v3/define-component-test.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -1138,3 +1138,10 @@ defineComponent({
11381138
}
11391139
}
11401140
})
1141+
1142+
// https://github.com/vuejs/vue/issues/12628#issuecomment-1177258223
1143+
defineComponent({
1144+
render(h) {
1145+
return h('div', {}, [...this.$slots.default!])
1146+
}
1147+
})

types/v3-component-public-instance.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
ComponentOptionsBase
1919
} from './v3-component-options'
2020
import { EmitFn, EmitsOptions, Slots } from './v3-setup-context'
21+
import { VNode } from './vnode'
2122

2223
/**
2324
* Custom properties added to component instances in any way and can be accessed through `this`
@@ -162,7 +163,8 @@ export type ComponentPublicInstance<
162163
>
163164
$attrs: Data
164165
$refs: Data
165-
$slots: Slots
166+
$slots: Record<string, VNode[] | undefined>
167+
$scopedSlots: Slots
166168
$root: ComponentPublicInstance | null
167169
$parent: ComponentPublicInstance | null
168170
$emit: EmitFn<E>

0 commit comments

Comments
 (0)