mattpocock/ts-reset

Improve `reportError`

Closed this issue · 4 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

qb20nh commented

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

Seems not like TypeScript.

@qb20nh

Thanks for the research, that makes enough sense to me that we should close this.

This is marked completed but I'm curious what the final code is