Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add emits options to defineComponent(fix #553) #554

Merged
merged 1 commit into from
Oct 10, 2020
Merged

fix: add emits options to defineComponent(fix #553) #554

merged 1 commit into from
Oct 10, 2020

Conversation

Mister-Hope
Copy link
Contributor

@Mister-Hope Mister-Hope commented Oct 8, 2020

https://v3.vuejs.org/guide/component-custom-events.html#defining-custom-events

https://eslint.vuejs.org/rules/require-explicit-emits.html

TIP

It is recommended to define all emitted events in order to better document how a component should work.

Though it has no effects on Vue2, but we can still add emits: string[] | Record<string, null | ((emitData: any) => boolean) > in defineComponent for better documenting and to avoid eslint-plugin-vue@V7 throwing warnings.

Also, we have to warn people in readme that this has no effects for validating the emit event and just for smoothing the miragation.


Adding emits options will broke ThisType in defineComponent now.

image

image

while eslint will throw warnings if using vue/require-explicit-emits

image

@antfu antfu merged commit e44311f into vuejs:master Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants