diff --git a/types/test/options-test.ts b/types/test/options-test.ts index 17a54fd360b..dc334b0f31e 100644 --- a/types/test/options-test.ts +++ b/types/test/options-test.ts @@ -296,8 +296,8 @@ Vue.component('component-with-scoped-slot', { child: { render (this: Vue, h: CreateElement) { return h('div', [ - this.$scopedSlots['default']({ msg: 'hi' }), - this.$scopedSlots['item']({ msg: 'hello' }) + this.$scopedSlots['default']!({ msg: 'hi' }), + this.$scopedSlots['item']!({ msg: 'hello' }) ]) } } @@ -306,7 +306,7 @@ Vue.component('component-with-scoped-slot', { Vue.component('narrow-array-of-vnode-type', { render (h): VNode { - const slot = this.$scopedSlots.default({}) + const slot = this.$scopedSlots.default!({}) if (typeof slot !== 'string') { const first = slot[0] if (!Array.isArray(first) && typeof first !== 'string') { diff --git a/types/vue.d.ts b/types/vue.d.ts index 179fb5fe38e..af51c106e33 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -27,8 +27,8 @@ export interface Vue { readonly $root: Vue; readonly $children: Vue[]; readonly $refs: { [key: string]: Vue | Element | Vue[] | Element[] }; - readonly $slots: { [key: string]: VNode[] }; - readonly $scopedSlots: { [key: string]: ScopedSlot }; + readonly $slots: { [key: string]: VNode[] | undefined }; + readonly $scopedSlots: { [key: string]: ScopedSlot | undefined }; readonly $isServer: boolean; readonly $data: Record; readonly $props: Record;