]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(types): ensure createBlock() helper accepts Teleport and Supsense types (fix...
authorThorsten Lünborg <t.luenborg@googlemail.com>
Thu, 20 Oct 2022 19:45:51 +0000 (21:45 +0200)
committerGitHub <noreply@github.com>
Thu, 20 Oct 2022 19:45:51 +0000 (21:45 +0200)
Co-authored-by: Carlos Rodrigues <carlos@hypermob.co.uk>
packages/runtime-core/src/vnode.ts
test-dts/compiler.test-d.ts [new file with mode: 0644]

index b731dc0b51f3887847a0a514aed7730ab1743688..2122f9f855aa6009e8945f2ed2ad3705a0411138 100644 (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 =
diff --git a/test-dts/compiler.test-d.ts b/test-dts/compiler.test-d.ts
new file mode 100644 (file)
index 0000000..974b494
--- /dev/null
@@ -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({})))