Skip to content

Commit

Permalink
fix(types): make VNodeDirective properties optional, fix vuejs#8013 (v…
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD authored and hefeng committed Jan 25, 2019
1 parent 9100949 commit 1347fc8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
6 changes: 5 additions & 1 deletion types/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,13 @@ export interface WatchOptionsWithHandler<T> extends WatchOptions {
handler: WatchHandler<T>;
}

export interface DirectiveBinding extends Readonly<VNodeDirective> {
readonly modifiers: { [key: string]: boolean };
}

export type DirectiveFunction = (
el: HTMLElement,
binding: VNodeDirective,
binding: DirectiveBinding,
vnode: VNode,
oldVnode: VNode
) => void;
Expand Down
4 changes: 4 additions & 0 deletions types/test/options-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ Vue.component('component', {
props: {
myProp: "bar"
},
directives: [{
name: 'a',
value: 'foo'
}],
domProps: {
innerHTML: "baz"
},
Expand Down
12 changes: 6 additions & 6 deletions types/vnode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ export interface VNodeData {
}

export interface VNodeDirective {
readonly name: string;
readonly value: any;
readonly oldValue: any;
readonly expression: any;
readonly arg: string;
readonly modifiers: { [key: string]: boolean };
name: string;
value?: any;
oldValue?: any;
expression?: any;
arg?: string;
modifiers?: { [key: string]: boolean };
}

0 comments on commit 1347fc8

Please sign in to comment.