Skip to content

Commit 5e28a8c

Browse files
committed
types(v-node-directive): changed expression type of VNodeDerective to optional string
fix vuejs#10871
1 parent bce5b98 commit 5e28a8c

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

types/test/options-test.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Vue.component('component', {
182182
},
183183
directives: [{
184184
name: 'a',
185-
value: 'foo'
185+
value: 'foo',
186186
}],
187187
domProps: {
188188
innerHTML: "baz"
@@ -478,3 +478,20 @@ Vue.component('functional-component-v-model', {
478478

479479

480480
Vue.component('async-es-module-component', () => import('./es-module'))
481+
482+
Vue.component('directive-expression-optional-string', {
483+
render(createElement) {
484+
return createElement("div", {
485+
directives: [
486+
{
487+
name: 'has-expression',
488+
value: 2,
489+
expression: '1 + 1',
490+
}, {
491+
name: 'no-expression',
492+
value: 'foo',
493+
},
494+
],
495+
})
496+
}
497+
});

types/vnode.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export interface VNodeDirective {
6969
name: string;
7070
value?: any;
7171
oldValue?: any;
72-
expression?: any;
72+
expression?: string;
7373
arg?: string;
7474
oldArg?: string;
7575
modifiers?: { [key: string]: boolean };

0 commit comments

Comments
 (0)