types(runtime-core): provide valid type for default $emit (#1498)
This commit is contained in:
@@ -6,7 +6,8 @@ import {
|
||||
reactive,
|
||||
createApp,
|
||||
expectError,
|
||||
expectType
|
||||
expectType,
|
||||
ComponentPublicInstance
|
||||
} from './index'
|
||||
|
||||
describe('with object props', () => {
|
||||
@@ -669,4 +670,17 @@ describe('emits', () => {
|
||||
expectError(this.$emit('nope'))
|
||||
}
|
||||
})
|
||||
|
||||
// without emits
|
||||
defineComponent({
|
||||
setup(props, { emit }) {
|
||||
emit('test', 1)
|
||||
emit('test')
|
||||
}
|
||||
})
|
||||
|
||||
// emit should be valid when ComponentPublicInstance is used.
|
||||
const instance = {} as ComponentPublicInstance
|
||||
instance.$emit('test', 1)
|
||||
instance.$emit('test')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user