Skip to content

Commit 3cb4dc9

Browse files
feat(types): add slots types for built-in components (#6033)
1 parent 1b1242f commit 3cb4dc9

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

packages/runtime-core/src/components/BaseTransition.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ if (__COMPAT__) {
283283
export const BaseTransition = BaseTransitionImpl as unknown as {
284284
new (): {
285285
$props: BaseTransitionProps<any>
286+
$slots: {
287+
default(): VNode[]
288+
}
286289
}
287290
}
288291

packages/runtime-core/src/components/KeepAlive.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,9 @@ export const KeepAlive = KeepAliveImpl as any as {
344344
__isKeepAlive: true
345345
new (): {
346346
$props: VNodeProps & KeepAliveProps
347+
$slots: {
348+
default(): VNode[]
349+
}
347350
}
348351
}
349352

packages/runtime-core/src/components/Suspense.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,13 @@ export const Suspense = (__FEATURE_SUSPENSE__
104104
? SuspenseImpl
105105
: null) as unknown as {
106106
__isSuspense: true
107-
new (): { $props: VNodeProps & SuspenseProps }
107+
new (): {
108+
$props: VNodeProps & SuspenseProps
109+
$slots: {
110+
default(): VNode[]
111+
fallback(): VNode[]
112+
}
113+
}
108114
}
109115

110116
function triggerEvent(

packages/runtime-core/src/components/Teleport.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,12 @@ function hydrateTeleport(
393393
// Force-casted public typing for h and TSX props inference
394394
export const Teleport = TeleportImpl as unknown as {
395395
__isTeleport: true
396-
new (): { $props: VNodeProps & TeleportProps }
396+
new(): {
397+
$props: VNodeProps & TeleportProps
398+
$slots: {
399+
default(): VNode[]
400+
}
401+
}
397402
}
398403

399404
function updateCssVars(vnode: VNode) {

0 commit comments

Comments
 (0)