fix(types): ensure createBlock() helper accepts Teleport and Supsense types (fix: #2855) (#5458)

Co-authored-by: Carlos Rodrigues <carlos@hypermob.co.uk>
This commit is contained in:
Thorsten Lünborg 2022-10-20 21:45:51 +02:00 committed by GitHub
parent bc167b5c6c
commit e5fc7dcc02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import { RawSlots } from './componentSlots'
import { isProxy, Ref, toRaw, ReactiveFlags, isRef } from '@vue/reactivity'
import { AppContext } from './apiCreateApp'
import {
Suspense,
SuspenseImpl,
isSuspense,
SuspenseBoundary
@ -31,7 +32,7 @@ import {
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
@ -63,7 +64,9 @@ export type VNodeTypes =
| typeof Static
| typeof Comment
| typeof Fragment
| typeof Teleport
| typeof TeleportImpl
| typeof Suspense
| typeof SuspenseImpl
export type VNodeRef =

View File

@ -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({})))