| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- import {
- ComponentPropsOptions,
- ExtractDefaultPropTypes,
- ExtractPropTypes
- } from './v3-component-props'
- import {
- MethodOptions,
- ComputedOptions,
- ComponentOptionsWithoutProps,
- ComponentOptionsWithArrayProps,
- ComponentOptionsWithProps,
- ComponentOptionsMixin,
- ComponentOptionsBase
- } from './v3-component-options'
- import {
- ComponentPublicInstanceConstructor,
- CreateComponentPublicInstance
- } from './v3-component-public-instance'
- import { Data, HasDefined } from './common'
- import { EmitsOptions } from './v3-setup-context'
- type DefineComponent<
- PropsOrPropOptions = {},
- RawBindings = {},
- D = {},
- C extends ComputedOptions = ComputedOptions,
- M extends MethodOptions = MethodOptions,
- Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
- Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
- E extends EmitsOptions = {},
- EE extends string = string,
- Props = Readonly<
- PropsOrPropOptions extends ComponentPropsOptions
- ? ExtractPropTypes<PropsOrPropOptions>
- : PropsOrPropOptions
- >,
- Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>
- > = ComponentPublicInstanceConstructor<
- CreateComponentPublicInstance<
- Props,
- RawBindings,
- D,
- C,
- M,
- Mixin,
- Extends,
- E,
- Props,
- Defaults,
- true
- > &
- Props
- > &
- ComponentOptionsBase<
- Props,
- RawBindings,
- D,
- C,
- M,
- Mixin,
- Extends,
- E,
- EE,
- Defaults
- > & {
- props: PropsOrPropOptions
- }
- /**
- * overload 1: object format with no props
- */
- export function defineComponent<
- RawBindings,
- D = Data,
- C extends ComputedOptions = {},
- M extends MethodOptions = {},
- Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
- Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
- Emits extends EmitsOptions = {},
- EmitsNames extends string = string
- >(
- options: ComponentOptionsWithoutProps<
- {},
- RawBindings,
- D,
- C,
- M,
- Mixin,
- Extends,
- Emits,
- EmitsNames
- >
- ): DefineComponent<{}, RawBindings, D, C, M, Mixin, Extends, Emits>
- /**
- * overload 2: object format with array props declaration
- * props inferred as `{ [key in PropNames]?: any }`
- *
- * return type is for Vetur and TSX support
- */
- export function defineComponent<
- PropNames extends string,
- RawBindings = Data,
- D = Data,
- C extends ComputedOptions = {},
- M extends MethodOptions = {},
- Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
- Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
- Emits extends EmitsOptions = {},
- EmitsNames extends string = string,
- PropsOptions extends ComponentPropsOptions = ComponentPropsOptions
- >(
- options: ComponentOptionsWithArrayProps<
- PropNames,
- RawBindings,
- D,
- C,
- M,
- Mixin,
- Extends,
- Emits,
- EmitsNames
- >
- ): DefineComponent<
- Readonly<{ [key in PropNames]?: any }>,
- RawBindings,
- D,
- C,
- M,
- Mixin,
- Extends,
- Emits
- >
- /**
- * overload 3: object format with object props declaration
- *
- * see `ExtractPropTypes` in './componentProps.ts'
- */
- export function defineComponent<
- Props,
- RawBindings = Data,
- D = Data,
- C extends ComputedOptions = {},
- M extends MethodOptions = {},
- Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
- Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
- Emits extends EmitsOptions = {},
- EmitsNames extends string = string,
- PropsOptions extends ComponentPropsOptions = ComponentPropsOptions
- >(
- options: HasDefined<Props> extends true
- ? ComponentOptionsWithProps<
- PropsOptions,
- RawBindings,
- D,
- C,
- M,
- Mixin,
- Extends,
- Emits,
- EmitsNames,
- Props
- >
- : ComponentOptionsWithProps<
- PropsOptions,
- RawBindings,
- D,
- C,
- M,
- Mixin,
- Extends,
- Emits,
- EmitsNames
- >
- ): DefineComponent<PropsOptions, RawBindings, D, C, M, Mixin, Extends, Emits>
|