types: use RenderFunction type (#342)

This commit is contained in:
Dmitry Sharshakov 2019-10-21 20:44:01 +03:00 committed by Evan You
parent 520af9787b
commit 1f4937c2fd
2 changed files with 5 additions and 6 deletions

View File

@ -5,8 +5,7 @@ import {
ComponentOptionsWithArrayProps, ComponentOptionsWithArrayProps,
ComponentOptionsWithObjectProps ComponentOptionsWithObjectProps
} from './apiOptions' } from './apiOptions'
import { SetupContext } from './component' import { SetupContext, RenderFunction } from './component'
import { VNodeChild } from './vnode'
import { ComponentPublicInstance } from './componentProxy' import { ComponentPublicInstance } from './componentProxy'
import { ExtractPropTypes } from './componentProps' import { ExtractPropTypes } from './componentProps'
import { isFunction } from '@vue/shared' import { isFunction } from '@vue/shared'
@ -14,7 +13,7 @@ import { isFunction } from '@vue/shared'
// overload 1: direct setup function // overload 1: direct setup function
// (uses user defined props interface) // (uses user defined props interface)
export function createComponent<Props, RawBindings = object>( export function createComponent<Props, RawBindings = object>(
setup: (props: Props, ctx: SetupContext) => RawBindings | (() => VNodeChild) setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction
): { ): {
new (): ComponentPublicInstance<Props, RawBindings> new (): ComponentPublicInstance<Props, RawBindings>
} }

View File

@ -2,7 +2,8 @@ import {
ComponentInternalInstance, ComponentInternalInstance,
Data, Data,
Component, Component,
SetupContext SetupContext,
RenderFunction
} from './component' } from './component'
import { import {
isFunction, isFunction,
@ -32,7 +33,6 @@ import {
import { reactive } from '@vue/reactivity' import { reactive } from '@vue/reactivity'
import { ComponentObjectPropsOptions, ExtractPropTypes } from './componentProps' import { ComponentObjectPropsOptions, ExtractPropTypes } from './componentProps'
import { Directive } from './directives' import { Directive } from './directives'
import { VNodeChild } from './vnode'
import { ComponentPublicInstance } from './componentProxy' import { ComponentPublicInstance } from './componentProxy'
import { warn } from './warning' import { warn } from './warning'
@ -47,7 +47,7 @@ interface ComponentOptionsBase<
this: null, this: null,
props: Props, props: Props,
ctx: SetupContext ctx: SetupContext
) => RawBindings | (() => VNodeChild) | void ) => RawBindings | RenderFunction | void
name?: string name?: string
template?: string template?: string
// Note: we are intentionally using the signature-less `Function` type here // Note: we are intentionally using the signature-less `Function` type here