test: add test for defineComponent function syntax with object emits
This commit is contained in:
parent
efb54e7315
commit
e3de9a6911
|
@ -1300,6 +1300,22 @@ describe('function syntax w/ emits', () => {
|
||||||
expectType<JSX.Element>(<Foo msg="hi" onFoo={() => {}} />)
|
expectType<JSX.Element>(<Foo msg="hi" onFoo={() => {}} />)
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
expectType<JSX.Element>(<Foo msg="hi" onBar={() => {}} />)
|
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', () => {
|
describe('function syntax w/ runtime props', () => {
|
||||||
|
|
Loading…
Reference in New Issue