Skip to content

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

Closed
niemyjski opened this issue Apr 20, 2015 · 9 comments
Closed

Incorrect definition for window.onerror #2838

niemyjski opened this issue Apr 20, 2015 · 9 comments
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue

Comments

@niemyjski
Copy link

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/

@niemyjski
Copy link
Author

If you want, I could do a pull request for this.

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Apr 20, 2015
@niemyjski
Copy link
Author

Do you think I should remove the existing definitions for this and update the interface to be this new spec?

@niemyjski
Copy link
Author

I'm also wondering if the handler name should be renamed to what the spec is.

@niemyjski
Copy link
Author

But this change would break people if I did either of the two and you were using a custom handler (not likely)

@mhegazy
Copy link
Contributor

mhegazy commented Apr 20, 2015

Can you check the latest lib.d.ts version. how is that diffrent from the documentation?

@mhegazy mhegazy removed the Help Wanted You can do this label Apr 20, 2015
@niemyjski
Copy link
Author

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;
}

@mhegazy
Copy link
Contributor

mhegazy commented Apr 20, 2015

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.

@mhegazy mhegazy added this to the TypeScript 1.6 milestone Apr 20, 2015
@mhegazy mhegazy self-assigned this Apr 20, 2015
@niemyjski
Copy link
Author

Just let me know when you want me to change these and I'll do a pull request :)

@mhegazy mhegazy added the Revisit An issue worth coming back to label Apr 22, 2015
@stimms
Copy link

stimms commented Jun 8, 2015

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?

@mhegazy mhegazy assigned zhengbli and unassigned mhegazy Jun 8, 2015
@mhegazy mhegazy removed the Revisit An issue worth coming back to label Jul 1, 2015
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Aug 10, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

5 participants