From 7c754623541c492161f7976203f0b1697a9a0113 Mon Sep 17 00:00:00 2001 From: Kawokas Date: Tue, 30 Mar 2021 18:37:56 +0900 Subject: [PATCH] fix(types): changed expression type to optional string (#11189) fix #10871 --- types/test/options-test.ts | 17 +++++++++++++++++ types/vnode.d.ts | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/types/test/options-test.ts b/types/test/options-test.ts index 024916b4a7..cb8fa2e3f1 100644 --- a/types/test/options-test.ts +++ b/types/test/options-test.ts @@ -482,3 +482,20 @@ Vue.component('functional-component-v-model', { Vue.component('async-es-module-component', () => import('./es-module')) + +Vue.component('directive-expression-optional-string', { + render(createElement) { + return createElement("div", { + directives: [ + { + name: 'has-expression', + value: 2, + expression: '1 + 1', + }, { + name: 'no-expression', + value: 'foo', + }, + ], + }) + } +}); diff --git a/types/vnode.d.ts b/types/vnode.d.ts index dc4470ffd8..04b058cba4 100644 --- a/types/vnode.d.ts +++ b/types/vnode.d.ts @@ -69,7 +69,7 @@ export interface VNodeDirective { name: string; value?: any; oldValue?: any; - expression?: any; + expression?: string; arg?: string; oldArg?: string; modifiers?: { [key: string]: boolean };