]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: fix typing for withDirectives
authorEvan You <yyx990803@gmail.com>
Sat, 26 Oct 2019 20:32:27 +0000 (16:32 -0400)
committerEvan You <yyx990803@gmail.com>
Sat, 26 Oct 2019 20:32:27 +0000 (16:32 -0400)
packages/runtime-core/src/directives.ts

index 052138a83ef460cd69f9609346c48a70cc101020..9f77358706b83d1951848b6ddb3c72a9825cff8a 100644 (file)
@@ -104,11 +104,14 @@ export type DirectiveArguments = Array<
   | [Directive, any, string, DirectiveModifiers]
 >
 
-export function withDirectives(vnode: VNode, directives: DirectiveArguments) {
+export function withDirectives<T extends VNode>(
+  vnode: T,
+  directives: DirectiveArguments
+): T {
   const internalInstance = currentRenderingInstance
   if (internalInstance === null) {
     __DEV__ && warn(`withDirectives can only be used inside render functions.`)
-    return
+    return vnode
   }
   const instance = internalInstance.renderProxy
   const props = vnode.props || (vnode.props = {})