total-typescript / ts-reset

A 'CSS reset' for TypeScript, improving types for common JavaScript API's

Home Page:https://www.totaltypescript.com/ts-reset

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve `reportError`

devinrhode2 opened this issue · comments

lib.dom has this code:

declare function reportError(e: any): void;

This would be better:

/**
 * The `reportError()` global method may be used to report errors
 * to the console or global event handlers,
 * emulating an uncaught JavaScript exception.
 * 
 * https://developer.mozilla.org/en-US/docs/Web/API/reportError
 */
declare function reportError(e: Error): void;

mdn docs:
https://developer.mozilla.org/en-US/docs/Web/API/reportError

It is defined as any on the html spec
https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope-mixin

interface mixin WindowOrWorkerGlobalScope {
  ...
  undefined reportError(any e);
  ...
};