Can I update the extern for AbortController in the Google closure compiler?

25 Views Asked by At

I'm working on an application that uses Fetch in the browser. The compiler (v20221102) complains:

.../src/main/js/src/Fetch.js:766:29: WARNING - [JSC_WRONG_ARGUMENT_COUNT] Function AbortController.prototype.abort: called with 1 argument(s). Function requires at least 0 argument(s) and no more than 0 argument(s).
  766|             setTimeout(() => controller.abort(reason), wait);`

AFAICT, this is because the extern for AbortController in externs/browser/w3c_abort.js (in the Closure compiler source) defines:

AbortController.prototype.abort = function() {};

Is there any way I can override or extend this prototype to avoid the warnings? AFAICT, the browser implementation of AbortController now allows a reason to be passed to the abort method.

0

There are 0 best solutions below