Skip to content

Commit e3de9a6

Browse files
committed
test: add test for defineComponent function syntax with object emits
1 parent efb54e7 commit e3de9a6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/dts-test/defineComponent.test-d.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,6 +1300,22 @@ describe('function syntax w/ emits', () => {
13001300
expectType<JSX.Element>(<Foo msg="hi" onFoo={() => {}} />)
13011301
// @ts-expect-error
13021302
expectType<JSX.Element>(<Foo msg="hi" onBar={() => {}} />)
1303+
1304+
defineComponent(
1305+
(props: { msg: string }, ctx) => {
1306+
ctx.emit('foo', 'hi')
1307+
// @ts-expect-error
1308+
ctx.emit('foo')
1309+
// @ts-expect-error
1310+
ctx.emit('bar')
1311+
return () => {}
1312+
},
1313+
{
1314+
emits: {
1315+
foo: (a: string) => true
1316+
}
1317+
}
1318+
)
13031319
})
13041320

13051321
describe('function syntax w/ runtime props', () => {

0 commit comments

Comments
 (0)