diff --git a/types/test/options-test.ts b/types/test/options-test.ts index fb06abb583b..04886735c13 100644 --- a/types/test/options-test.ts +++ b/types/test/options-test.ts @@ -182,7 +182,7 @@ Vue.component('component', { }, directives: [{ name: 'a', - value: 'foo' + value: 'foo', }], domProps: { innerHTML: "baz" @@ -478,3 +478,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 dc4470ffd84..04b058cba4c 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 };