]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: add internal flag to work around ts issue
authorEvan You <yyx990803@gmail.com>
Fri, 3 May 2024 23:57:47 +0000 (16:57 -0700)
committerEvan You <yyx990803@gmail.com>
Fri, 3 May 2024 23:57:47 +0000 (16:57 -0700)
packages/runtime-core/src/directives.ts

index c6dce57c1b680a5e189e6edfbf08306518531732..afc7d3c1d28badca2b47b030906026006db11ae3 100644 (file)
@@ -52,8 +52,12 @@ export type DirectiveHook<
   prevVNode: Prev,
 ) => void
 
-export type SSRDirectiveHook = (
-  binding: DirectiveBinding,
+export type SSRDirectiveHook<
+  Value = any,
+  Modifiers extends string = string,
+  Arg extends string = string,
+> = (
+  binding: DirectiveBinding<Value, Modifiers, Arg>,
   vnode: VNode,
 ) => Data | undefined
 
@@ -63,6 +67,12 @@ export interface ObjectDirective<
   Modifiers extends string = string,
   Arg extends string = string,
 > {
+  /**
+   * @internal without this, ts-expect-error in directives.test-d.ts somehow
+   * fails when running tsc, but passes in IDE and when testing against built
+   * dts. Could be a TS bug.
+   */
+  __mod?: Modifiers
   created?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>
   beforeMount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>
   mounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>
@@ -82,7 +92,7 @@ export interface ObjectDirective<
   >
   beforeUnmount?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>
   unmounted?: DirectiveHook<HostElement, null, Value, Modifiers, Arg>
-  getSSRProps?: SSRDirectiveHook
+  getSSRProps?: SSRDirectiveHook<Value, Modifiers, Arg>
   deep?: boolean
 }