Skip to content

Commit e5fc7dc

Browse files
LinusBorgpikax
andauthored
fix(types): ensure createBlock() helper accepts Teleport and Supsense types (fix: #2855) (#5458)
Co-authored-by: Carlos Rodrigues <[email protected]>
1 parent bc167b5 commit e5fc7dc

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

packages/runtime-core/src/vnode.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ import { RawSlots } from './componentSlots'
2424
import { isProxy, Ref, toRaw, ReactiveFlags, isRef } from '@vue/reactivity'
2525
import { AppContext } from './apiCreateApp'
2626
import {
27+
Suspense,
2728
SuspenseImpl,
2829
isSuspense,
2930
SuspenseBoundary
3031
} from './components/Suspense'
3132
import { DirectiveBinding } from './directives'
3233
import { TransitionHooks } from './components/BaseTransition'
3334
import { warn } from './warning'
34-
import { TeleportImpl, isTeleport } from './components/Teleport'
35+
import { Teleport, TeleportImpl, isTeleport } from './components/Teleport'
3536
import {
3637
currentRenderingInstance,
3738
currentScopeId
@@ -63,7 +64,9 @@ export type VNodeTypes =
6364
| typeof Static
6465
| typeof Comment
6566
| typeof Fragment
67+
| typeof Teleport
6668
| typeof TeleportImpl
69+
| typeof Suspense
6770
| typeof SuspenseImpl
6871

6972
export type VNodeRef =

test-dts/compiler.test-d.ts

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {
2+
expectType,
3+
createBlock,
4+
VNode,
5+
Teleport,
6+
Text,
7+
Static,
8+
Comment,
9+
Fragment,
10+
Suspense,
11+
defineComponent
12+
} from './index'
13+
14+
expectType<VNode>(createBlock(Teleport))
15+
expectType<VNode>(createBlock(Text))
16+
expectType<VNode>(createBlock(Static))
17+
expectType<VNode>(createBlock(Comment))
18+
expectType<VNode>(createBlock(Fragment))
19+
expectType<VNode>(createBlock(Suspense))
20+
expectType<VNode>(createBlock(defineComponent({})))

0 commit comments

Comments
 (0)