test: add test for defineComponent function syntax with object emits

This commit is contained in:
Evan You 2023-03-28 08:57:56 +08:00
parent efb54e7315
commit e3de9a6911
1 changed files with 16 additions and 0 deletions

View File

@ -1300,6 +1300,22 @@ describe('function syntax w/ emits', () => {
expectType<JSX.Element>(<Foo msg="hi" onFoo={() => {}} />)
// @ts-expect-error
expectType<JSX.Element>(<Foo msg="hi" onBar={() => {}} />)
defineComponent(
(props: { msg: string }, ctx) => {
ctx.emit('foo', 'hi')
// @ts-expect-error
ctx.emit('foo')
// @ts-expect-error
ctx.emit('bar')
return () => {}
},
{
emits: {
foo: (a: string) => true
}
}
)
})
describe('function syntax w/ runtime props', () => {