diff --git a/src/component/componentOptions.ts b/src/component/componentOptions.ts index 117cd511..21083455 100644 --- a/src/component/componentOptions.ts +++ b/src/component/componentOptions.ts @@ -8,6 +8,13 @@ export { ComponentPropsOptions } from './componentProps' export type ComputedGetter = (ctx?: any) => T export type ComputedSetter = (v: T) => void +export type ObjectEmitsOptions = Record< + string, + ((...args: any[]) => any) | null +> + +export type EmitsOptions = ObjectEmitsOptions | string[] + export interface WritableComputedOptions { get: ComputedGetter set: ComputedSetter @@ -63,7 +70,7 @@ export type ComponentOptionsWithProps< Props = ExtractPropTypes > = ComponentOptionsBase & { props?: PropsOptions - emits?: string[] | Record boolean)> + emits?: (EmitsOptions | string[]) & ThisType setup?: SetupFunction } & ThisType> @@ -76,7 +83,7 @@ export type ComponentOptionsWithArrayProps< Props = Readonly<{ [key in PropNames]?: any }> > = ComponentOptionsBase & { props?: PropNames[] - emits?: string[] | Record boolean)> + emits?: (EmitsOptions | string[]) & ThisType setup?: SetupFunction } & ThisType> @@ -88,7 +95,7 @@ export type ComponentOptionsWithoutProps< M extends MethodOptions = {} > = ComponentOptionsBase & { props?: undefined - emits?: string[] | Record boolean)> + emits?: (EmitsOptions | string[]) & ThisType setup?: SetupFunction } & ThisType>