Skip to content

Commit

Permalink
feat(types): add slots types for built-in components (#6033)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk authored May 5, 2023
1 parent 1b1242f commit 3cb4dc9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/runtime-core/src/components/BaseTransition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ if (__COMPAT__) {
export const BaseTransition = BaseTransitionImpl as unknown as {
new (): {
$props: BaseTransitionProps<any>
$slots: {
default(): VNode[]
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions packages/runtime-core/src/components/KeepAlive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ export const KeepAlive = KeepAliveImpl as any as {
__isKeepAlive: true
new (): {
$props: VNodeProps & KeepAliveProps
$slots: {
default(): VNode[]
}
}
}

Expand Down
8 changes: 7 additions & 1 deletion packages/runtime-core/src/components/Suspense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,13 @@ export const Suspense = (__FEATURE_SUSPENSE__
? SuspenseImpl
: null) as unknown as {
__isSuspense: true
new (): { $props: VNodeProps & SuspenseProps }
new (): {
$props: VNodeProps & SuspenseProps
$slots: {
default(): VNode[]
fallback(): VNode[]
}
}
}

function triggerEvent(
Expand Down
7 changes: 6 additions & 1 deletion packages/runtime-core/src/components/Teleport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,12 @@ function hydrateTeleport(
// Force-casted public typing for h and TSX props inference
export const Teleport = TeleportImpl as unknown as {
__isTeleport: true
new (): { $props: VNodeProps & TeleportProps }
new(): {
$props: VNodeProps & TeleportProps
$slots: {
default(): VNode[]
}
}
}

function updateCssVars(vnode: VNode) {
Expand Down

0 comments on commit 3cb4dc9

Please sign in to comment.