Skip to content

Commit

Permalink
fix(types): align emits type with vue-next
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 31, 2021
1 parent cb60681 commit 565cbd1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/component/componentOptions.ts
Expand Up @@ -8,6 +8,13 @@ export { ComponentPropsOptions } from './componentProps'
export type ComputedGetter<T> = (ctx?: any) => T
export type ComputedSetter<T> = (v: T) => void

export type ObjectEmitsOptions = Record<
string,
((...args: any[]) => any) | null
>

export type EmitsOptions = ObjectEmitsOptions | string[]

export interface WritableComputedOptions<T> {
get: ComputedGetter<T>
set: ComputedSetter<T>
Expand Down Expand Up @@ -63,7 +70,7 @@ export type ComponentOptionsWithProps<
Props = ExtractPropTypes<PropsOptions>
> = ComponentOptionsBase<Props, D, C, M> & {
props?: PropsOptions
emits?: string[] | Record<string, null | ((emitData: any) => boolean)>
emits?: (EmitsOptions | string[]) & ThisType<void>
setup?: SetupFunction<Props, RawBindings>
} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M>>

Expand All @@ -76,7 +83,7 @@ export type ComponentOptionsWithArrayProps<
Props = Readonly<{ [key in PropNames]?: any }>
> = ComponentOptionsBase<Props, D, C, M> & {
props?: PropNames[]
emits?: string[] | Record<string, null | ((emitData: any) => boolean)>
emits?: (EmitsOptions | string[]) & ThisType<void>
setup?: SetupFunction<Props, RawBindings>
} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M>>

Expand All @@ -88,7 +95,7 @@ export type ComponentOptionsWithoutProps<
M extends MethodOptions = {}
> = ComponentOptionsBase<Props, D, C, M> & {
props?: undefined
emits?: string[] | Record<string, null | ((emitData: any) => boolean)>
emits?: (EmitsOptions | string[]) & ThisType<void>
setup?: SetupFunction<Props, RawBindings>
} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M>>

Expand Down

0 comments on commit 565cbd1

Please sign in to comment.