types(runtime-core): default SetupContext
generic argument to EmitsOptions
(#1584)
This commit is contained in:
parent
9188e9ea74
commit
d78a6821f5
@ -132,7 +132,7 @@ export const enum LifecycleHooks {
|
||||
ERROR_CAPTURED = 'ec'
|
||||
}
|
||||
|
||||
export interface SetupContext<E = ObjectEmitsOptions> {
|
||||
export interface SetupContext<E = EmitsOptions> {
|
||||
attrs: Data
|
||||
slots: Slots
|
||||
emit: EmitFn<E>
|
||||
|
@ -7,7 +7,9 @@ import {
|
||||
createApp,
|
||||
expectError,
|
||||
expectType,
|
||||
ComponentPublicInstance
|
||||
ComponentPublicInstance,
|
||||
ComponentOptions,
|
||||
SetupContext
|
||||
} from './index'
|
||||
|
||||
describe('with object props', () => {
|
||||
@ -684,3 +686,10 @@ describe('emits', () => {
|
||||
instance.$emit('test', 1)
|
||||
instance.$emit('test')
|
||||
})
|
||||
|
||||
describe('componentOptions setup should be `SetupContext`', () => {
|
||||
expect<ComponentOptions['setup']>({} as (
|
||||
props: Record<string, any>,
|
||||
ctx: SetupContext
|
||||
) => any)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user