From b5c2f7d7ba343017cec40cc39856149baac019ba Mon Sep 17 00:00:00 2001 From: DSha Date: Wed, 6 Mar 2019 05:46:56 +0800 Subject: [PATCH] types: use normalized type for `RenderContext.scopedSlots` (#9624) fix #9616 --- types/options.d.ts | 4 ++-- types/test/vue-test.ts | 7 +++++++ types/vue.d.ts | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/types/options.d.ts b/types/options.d.ts index 1bb5fbb619f..dcb38614ed3 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -1,5 +1,5 @@ import { Vue, CreateElement, CombinedVueInstance } from "./vue"; -import { VNode, VNodeData, VNodeDirective, ScopedSlot } from "./vnode"; +import { VNode, VNodeData, VNodeDirective, NormalizedScopedSlot } from "./vnode"; type Constructor = { new (...args: any[]): any; @@ -140,7 +140,7 @@ export interface RenderContext { data: VNodeData; parent: Vue; listeners: { [key: string]: Function | Function[] }; - scopedSlots: { [key: string]: ScopedSlot }; + scopedSlots: { [key: string]: NormalizedScopedSlot }; injections: any } diff --git a/types/test/vue-test.ts b/types/test/vue-test.ts index 54c4405264d..ca04e84714a 100644 --- a/types/test/vue-test.ts +++ b/types/test/vue-test.ts @@ -147,6 +147,13 @@ const FunctionalHelloWorldComponent = Vue.extend({ } }); +const FunctionalScopedSlotsComponent = Vue.extend({ + functional: true, + render(h, ctx) { + return ctx.scopedSlots.default && ctx.scopedSlots.default({}) || h('div', 'functional scoped slots'); + } +}); + const Parent = Vue.extend({ data() { return { greeting: 'Hello' } diff --git a/types/vue.d.ts b/types/vue.d.ts index be2477b3f27..204f9cca94d 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -12,7 +12,7 @@ import { ThisTypedComponentOptionsWithRecordProps, WatchOptions, } from "./options"; -import { VNode, VNodeData, VNodeChildren, ScopedSlot, NormalizedScopedSlot } from "./vnode"; +import { VNode, VNodeData, VNodeChildren, NormalizedScopedSlot } from "./vnode"; import { PluginFunction, PluginObject } from "./plugin"; export interface CreateElement {