Skip to content

Commit

Permalink
fix(types): fix this.$slots type for defineComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 8, 2022
1 parent 1d5a411 commit d3add06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions types/test/v3/define-component-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1138,3 +1138,10 @@ defineComponent({
}
}
})

// https://github.com/vuejs/vue/issues/12628#issuecomment-1177258223
defineComponent({
render(h) {
return h('div', {}, [...this.$slots.default!])
}
})
4 changes: 3 additions & 1 deletion types/v3-component-public-instance.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
ComponentOptionsBase
} from './v3-component-options'
import { EmitFn, EmitsOptions, Slots } from './v3-setup-context'
import { VNode } from './vnode'

/**
* Custom properties added to component instances in any way and can be accessed through `this`
Expand Down Expand Up @@ -162,7 +163,8 @@ export type ComponentPublicInstance<
>
$attrs: Data
$refs: Data
$slots: Slots
$slots: Record<string, VNode[] | undefined>
$scopedSlots: Slots
$root: ComponentPublicInstance | null
$parent: ComponentPublicInstance | null
$emit: EmitFn<E>
Expand Down

0 comments on commit d3add06

Please sign in to comment.