-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Incorrect definition for window.onerror #2838
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
Comments
If you want, I could do a pull request for this. |
Do you think I should remove the existing definitions for this and update the interface to be this new spec? |
I'm also wondering if the handler name should be renamed to what the spec is. |
But this change would break people if I did either of the two and you were using a custom handler (not likely) |
Can you check the latest lib.d.ts version. how is that diffrent from the documentation? |
Hello, The latest is: interface ErrorEventHandler {
(event: Event, source?: string, fileno?: number, columnNumber?: number): void;
(event: string, source?: string, fileno?: number, columnNumber?: number): void;
} and it should be according to the docs ( https://html.spec.whatwg.org/multipage/webappapis.html#errorevent ) interface ErrorEventHandler {
(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void;
} I'd prefer the names to be cleaned up a bit: interface ErrorEventHandler {
(message: string, filename?: string, line?: number, column?: number, error?:Error): void;
} |
I see. thanks for the explanation. These typings are auto generated so we can not change these definitions manually. @zhanbos is working on a script to allow changing them. once this happens a PR would be welcomed. |
Just let me know when you want me to change these and I'll do a pull request :) |
I have also just encountered this issue. Is there anything we can do to help @zhanbos out and make sure this fix makes 1.6? |
There is a new spec for window.onerror ( https://html.spec.whatwg.org/multipage/webappapis.html#errorevent ). I came across this when I tried to implement a custom handler in typescript and the definition was incorrect/outdated. I got this link from https://danlimerick.wordpress.com/2014/01/18/how-to-catch-javascript-errors-with-window-onerror-even-on-chrome-and-firefox/
The text was updated successfully, but these errors were encountered: