Navigation Menu

Skip to content

Commit

Permalink
fix(types): ensure createBlock() helper accepts Teleport and Supsense…
Browse files Browse the repository at this point in the history
… types (fix: #2855) (#5458)

Co-authored-by: Carlos Rodrigues <carlos@hypermob.co.uk>
  • Loading branch information
LinusBorg and pikax committed Oct 20, 2022
1 parent bc167b5 commit e5fc7dc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/runtime-core/src/vnode.ts
Expand Up @@ -24,14 +24,15 @@ import { RawSlots } from './componentSlots'
import { isProxy, Ref, toRaw, ReactiveFlags, isRef } from '@vue/reactivity'
import { AppContext } from './apiCreateApp'
import {
Suspense,
SuspenseImpl,
isSuspense,
SuspenseBoundary
} from './components/Suspense'
import { DirectiveBinding } from './directives'
import { TransitionHooks } from './components/BaseTransition'
import { warn } from './warning'
import { TeleportImpl, isTeleport } from './components/Teleport'
import { Teleport, TeleportImpl, isTeleport } from './components/Teleport'
import {
currentRenderingInstance,
currentScopeId
Expand Down Expand Up @@ -63,7 +64,9 @@ export type VNodeTypes =
| typeof Static
| typeof Comment
| typeof Fragment
| typeof Teleport
| typeof TeleportImpl
| typeof Suspense
| typeof SuspenseImpl

export type VNodeRef =
Expand Down
20 changes: 20 additions & 0 deletions test-dts/compiler.test-d.ts
@@ -0,0 +1,20 @@
import {
expectType,
createBlock,
VNode,
Teleport,
Text,
Static,
Comment,
Fragment,
Suspense,
defineComponent
} from './index'

expectType<VNode>(createBlock(Teleport))
expectType<VNode>(createBlock(Text))
expectType<VNode>(createBlock(Static))
expectType<VNode>(createBlock(Comment))
expectType<VNode>(createBlock(Fragment))
expectType<VNode>(createBlock(Suspense))
expectType<VNode>(createBlock(defineComponent({})))

0 comments on commit e5fc7dc

Please sign in to comment.