From f85ba092cec72e17da10d0eb720ef8197b1607f7 Mon Sep 17 00:00:00 2001 From: likui <2218301630@qq.com> Date: Tue, 22 Oct 2019 02:04:42 +0800 Subject: [PATCH] types: improve emit type (#345) --- packages/runtime-core/src/component.ts | 2 +- packages/runtime-core/src/componentProxy.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/runtime-core/src/component.ts b/packages/runtime-core/src/component.ts index 179aa866b8..da5f8a714a 100644 --- a/packages/runtime-core/src/component.ts +++ b/packages/runtime-core/src/component.ts @@ -60,7 +60,7 @@ export const enum LifecycleHooks { ERROR_CAPTURED = 'ec' } -type Emit = ((event: string, ...args: unknown[]) => void) +export type Emit = ((event: string, ...args: unknown[]) => void) export interface SetupContext { attrs: Data diff --git a/packages/runtime-core/src/componentProxy.ts b/packages/runtime-core/src/componentProxy.ts index f20caedd0b..32dd4edaf8 100644 --- a/packages/runtime-core/src/componentProxy.ts +++ b/packages/runtime-core/src/componentProxy.ts @@ -1,4 +1,4 @@ -import { ComponentInternalInstance, Data } from './component' +import { ComponentInternalInstance, Data, Emit } from './component' import { nextTick } from './scheduler' import { instanceWatch } from './apiWatch' import { EMPTY_OBJ, hasOwn, isGloballyWhitelisted } from '@vue/shared' @@ -24,7 +24,7 @@ export type ComponentPublicInstance< $slots: Data $root: ComponentInternalInstance | null $parent: ComponentInternalInstance | null - $emit: (event: string, ...args: unknown[]) => void + $emit: Emit $el: any $options: any $forceUpdate: ReactiveEffect -- 2.47.3