diff --git a/types/test/options-test.ts b/types/test/options-test.ts index 024916b4a70..cb8fa2e3f1b 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 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 };