I want to override XMLHttpRequest.prototype.open in Typescript but that's failing for me, is there a workaround ?
(function(open) {
XMLHttpRequest.prototype.open = (method, url, async, user, pass) => {
url = new URL(url);
if (window["_keycloak"] && window["_keycloak"].token)
url.searchParams.set('token', window["_keycloak"].token);
open.call(this, method, url, async, user, pass);
};
})(XMLHttpRequest.prototype.open);
This is the error message I'm getting
[ts] Type '(method: any, url: any, async: any, user: any, pass: any) => void' is not assignable to type '{ (method: string, url: string): void; (method: string, url: string, async: boolean, username?: string, password?: string): void; }'.