Skip to content
Permalink
Browse files

types: use normalized type for `RenderContext.scopedSlots` (#9624)

fix #9616
  • Loading branch information...
Shasharoman authored and yyx990803 committed Mar 5, 2019
1 parent 0c4c78b commit 731e4d0ebc997a6c2b1fc500b08924ff7ba091b6
Showing with 10 additions and 3 deletions.
  1. +2 −2 types/options.d.ts
  2. +7 −0 types/test/vue-test.ts
  3. +1 −1 types/vue.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<Props=DefaultProps> {
data: VNodeData;
parent: Vue;
listeners: { [key: string]: Function | Function[] };
scopedSlots: { [key: string]: ScopedSlot };
scopedSlots: { [key: string]: NormalizedScopedSlot };
injections: any
}

@@ -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' }
@@ -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 {

0 comments on commit 731e4d0

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.