} from './apiOptions'
import { SetupContext, RenderFunction } from './component'
import { ComponentPublicInstance } from './componentProxy'
-import { ExtractPropTypes } from './componentProps'
+import { ExtractPropTypes, ComponentPropsOptions } from './componentProps'
import { isFunction } from '@vue/shared'
import { VNodeProps } from './vnode'
// overload 1: direct setup function
// (uses user defined props interface)
-// __isConstructor: true is a type-only differentiator to avoid returned
-// constructor type from being matched as an options object in h()
export function createComponent<Props, RawBindings = object>(
setup: (props: Props, ctx: SetupContext) => RawBindings | RenderFunction
): {
- __isConstructor: true
new (): ComponentPublicInstance<
Props,
RawBindings,
>(
options: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M>
): {
- __isConstructor: true
new (): ComponentPublicInstance<
Props,
RawBindings,
>(
options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M>
): {
- __isConstructor: true
// array props technically doesn't place any contraints on props in TSX
new (): ComponentPublicInstance<VNodeProps, RawBindings, D, C, M>
}
// overload 4: object format with object props declaration
// see `ExtractPropTypes` in ./componentProps.ts
export function createComponent<
- PropsOptions,
+ PropsOptions extends Readonly<ComponentPropsOptions>,
RawBindings,
D,
C extends ComputedOptions = {},
>(
options: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M>
): {
- __isConstructor: true
// for Vetur and TSX support
new (): ComponentPublicInstance<
- ExtractPropTypes<PropsOptions, false>,
+ ExtractPropTypes<PropsOptions>,
RawBindings,
D,
C,