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(types): fix wrong errorCaptured type #7712

Merged
merged 2 commits into from
Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface ComponentOptions<
updated?(): void;
activated?(): void;
deactivated?(): void;
errorCaptured?(): boolean | void;
errorCaptured?(err: Error, vm: V, info: string): boolean | void;
Copy link
Member

@HerringtonDarkholme HerringtonDarkholme Feb 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vm the component instance that triggered the error

I think the type should be Vue because error can be propagated. Sovm is usually not the instance defined by the option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, thanks for pointing this out!


directives?: { [key: string]: DirectiveFunction | DirectiveOptions };
components?: { [key: string]: Component<any, any, any, any> | AsyncComponent<any, any, any, any> };
Expand Down
5 changes: 4 additions & 1 deletion types/test/options-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ Vue.component('component', {
updated() {},
activated() {},
deactivated() {},
errorCaptured() {
errorCaptured(err, vm, info) {
err.message
vm.$emit('error')
info.toUpperCase()
return true
},

Expand Down