]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
types: improve emit type (#345)
authorlikui <2218301630@qq.com>
Mon, 21 Oct 2019 18:04:42 +0000 (02:04 +0800)
committerEvan You <yyx990803@gmail.com>
Mon, 21 Oct 2019 18:04:42 +0000 (14:04 -0400)
packages/runtime-core/src/component.ts
packages/runtime-core/src/componentProxy.ts

index 179aa866b897141c0b4436f376dfc894de2d09fe..da5f8a714ab9db6bd8edfc4dc7dbff0d0344979a 100644 (file)
@@ -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
index f20caedd0b97b331553ce4441a24c201403a3477..32dd4edaf883f8fe90ca849743a493d9cc92b30e 100644 (file)
@@ -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