From 99a51b452fa13fc4392e87215a8c3024adf5f710 Mon Sep 17 00:00:00 2001 From: Kael Date: Tue, 23 Oct 2018 07:09:23 +1100 Subject: [PATCH] fix(types): make VNodeDirective properties optional, fix #8013 (#8003) --- types/options.d.ts | 6 +++++- types/test/options-test.ts | 4 ++++ types/vnode.d.ts | 12 ++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/types/options.d.ts b/types/options.d.ts index 25eb8a0fdf..8ae8f93599 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -160,9 +160,13 @@ export interface WatchOptionsWithHandler extends WatchOptions { handler: WatchHandler; } +export interface DirectiveBinding extends Readonly { + readonly modifiers: { [key: string]: boolean }; +} + export type DirectiveFunction = ( el: HTMLElement, - binding: VNodeDirective, + binding: DirectiveBinding, vnode: VNode, oldVnode: VNode ) => void; diff --git a/types/test/options-test.ts b/types/test/options-test.ts index 17a54fd360..83972d05c1 100644 --- a/types/test/options-test.ts +++ b/types/test/options-test.ts @@ -154,6 +154,10 @@ Vue.component('component', { props: { myProp: "bar" }, + directives: [{ + name: 'a', + value: 'foo' + }], domProps: { innerHTML: "baz" }, diff --git a/types/vnode.d.ts b/types/vnode.d.ts index 5754c433dc..9247c47457 100644 --- a/types/vnode.d.ts +++ b/types/vnode.d.ts @@ -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 }; }