Emitting event without an emits array does not produce a warning
Version
3.2.11
Reproduction link
Steps to reproduce
Use this.$emit to emit an event in development with the emits array undefined/null. In the repro you can uncomment the code to get the expected warning. This warning should also appear without defining the emits array.
What is expected?
If you emit an event without it being defined in the emits array it should always log a warning to the console.
What is actually happening?
Only if the emits array is defined a warning is logged due to an if check in https://github.com/vuejs/vue-next/blob/a6e5f82d8ea5fe55432d0277e88300045eca4237/packages/runtime-core/src/componentEmits.ts#L83. I believe this if check can be removed.
Happy to provide a PR if wanted.
I think the original idea was for emits
to be opt-in (easing transition from Vue 2). But as that would lead to potential bugs where listeners would also be added to the root element due to fall-through behavior, this might indeed be a useful warning.
Thoughts anyone?