@@ -19,18 +19,18 @@ import { currentRenderingInstance } from './componentRenderUtils'
19
19
import { callWithAsyncErrorHandling , ErrorCodes } from './errorHandling'
20
20
import { ComponentPublicInstance } from './componentProxy'
21
21
22
- export interface DirectiveBinding {
22
+ export interface DirectiveBinding < V = any > {
23
23
instance : ComponentPublicInstance | null
24
- value : any
25
- oldValue : any
24
+ value : V
25
+ oldValue : V | null
26
26
arg ?: string
27
27
modifiers : DirectiveModifiers
28
- dir : ObjectDirective
28
+ dir : ObjectDirective < any , V >
29
29
}
30
30
31
- export type DirectiveHook < T = any , Prev = VNode < any , T > | null > = (
31
+ export type DirectiveHook < T = any , Prev = VNode < any , T > | null , V = any > = (
32
32
el : T ,
33
- binding : DirectiveBinding ,
33
+ binding : DirectiveBinding < V > ,
34
34
vnode : VNode < any , T > ,
35
35
prevVNode : Prev
36
36
) => void
@@ -40,19 +40,21 @@ export type SSRDirectiveHook = (
40
40
vnode : VNode
41
41
) => Data | undefined
42
42
43
- export interface ObjectDirective < T = any > {
44
- beforeMount ?: DirectiveHook < T , null >
45
- mounted ?: DirectiveHook < T , null >
46
- beforeUpdate ?: DirectiveHook < T , VNode < any , T > >
47
- updated ?: DirectiveHook < T , VNode < any , T > >
48
- beforeUnmount ?: DirectiveHook < T , null >
49
- unmounted ?: DirectiveHook < T , null >
43
+ export interface ObjectDirective < T = any , V = any > {
44
+ beforeMount ?: DirectiveHook < T , null , V >
45
+ mounted ?: DirectiveHook < T , null , V >
46
+ beforeUpdate ?: DirectiveHook < T , VNode < any , T > , V >
47
+ updated ?: DirectiveHook < T , VNode < any , T > , V >
48
+ beforeUnmount ?: DirectiveHook < T , null , V >
49
+ unmounted ?: DirectiveHook < T , null , V >
50
50
getSSRProps ?: SSRDirectiveHook
51
51
}
52
52
53
- export type FunctionDirective < T = any > = DirectiveHook < T >
53
+ export type FunctionDirective < T = any , V = any > = DirectiveHook < T , any , V >
54
54
55
- export type Directive < T = any > = ObjectDirective < T > | FunctionDirective < T >
55
+ export type Directive < T = any , V = any > =
56
+ | ObjectDirective < T , V >
57
+ | FunctionDirective < T , V >
56
58
57
59
export type DirectiveModifiers = Record < string , boolean >
58
60
0 commit comments