Incorrect Definition for Window.onError #28638
Labels
Bug
A bug in TypeScript
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Help Wanted
You can do this
Milestone
Search Terms:
window.onerror
The interface is incorrect for window.onerror. If there is a thrown error like:
throw "This is an error";
Then the type of error is string. The spec for this interface is that error can be any, not just a nullable error. I think the interface should be changed to match spec, or at least allow a string type error:
Expected behavior:
https://html.spec.whatwg.org/multipage/webappapis.html#errorevent
interface ErrorEvent : Event {
readonly attribute DOMString message;
readonly attribute USVString filename;
readonly attribute unsigned long lineno;
readonly attribute unsigned long colno;
readonly attribute any error;
};
Actual behavior:
interface ErrorEventHandler {
(event: Event | string, source?: string, fileno?: number, columnNumber?: number, error?: Error): void;
}
Related Issues:
#2838
The text was updated successfully, but these errors were encountered: