Skip to content

Commit 99a51b4

Browse files
KaelWDyyx990803
authored andcommitted
fix(types): make VNodeDirective properties optional, fix #8013 (#8003)
1 parent 4dec3b5 commit 99a51b4

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

Diff for: types/options.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,13 @@ export interface WatchOptionsWithHandler<T> extends WatchOptions {
160160
handler: WatchHandler<T>;
161161
}
162162

163+
export interface DirectiveBinding extends Readonly<VNodeDirective> {
164+
readonly modifiers: { [key: string]: boolean };
165+
}
166+
163167
export type DirectiveFunction = (
164168
el: HTMLElement,
165-
binding: VNodeDirective,
169+
binding: DirectiveBinding,
166170
vnode: VNode,
167171
oldVnode: VNode
168172
) => void;

Diff for: types/test/options-test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ Vue.component('component', {
154154
props: {
155155
myProp: "bar"
156156
},
157+
directives: [{
158+
name: 'a',
159+
value: 'foo'
160+
}],
157161
domProps: {
158162
innerHTML: "baz"
159163
},

Diff for: types/vnode.d.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ export interface VNodeData {
5858
}
5959

6060
export interface VNodeDirective {
61-
readonly name: string;
62-
readonly value: any;
63-
readonly oldValue: any;
64-
readonly expression: any;
65-
readonly arg: string;
66-
readonly modifiers: { [key: string]: boolean };
61+
name: string;
62+
value?: any;
63+
oldValue?: any;
64+
expression?: any;
65+
arg?: string;
66+
modifiers?: { [key: string]: boolean };
6767
}

0 commit comments

Comments
 (0)