-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Description
π Search Terms
I search for .call overload, this might be related to #29789 but I'm not sure
π Version & Regression Information
- I looked back through some versions to 4.x on the playground and this was present in those I checked
β― Playground Link
π» Code
// this passes
const xhrOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function open(method, url) {
return xhrOpen(method, url);
};
// the use of `.call` reports "Expected 4-6 arguments, but got 3.(2554)"
XMLHttpRequest.prototype.open = function open(method, url) {
return xhrOpen.call(this, method, url); // error on this line
};π Actual behavior
.call reports "Expected 4-6 arguments, but got 3.(2554)"
π Expected behavior
The use of .call infers that it matches the first overload the same way this is inferred without .call
From https://raw.githubusercontent.com/microsoft/TypeScript-DOM-lib-generator/refs/heads/main/baselines/dom.generated.d.ts open is typed as:
/**
* The XMLHttpRequest method **`open()`** initializes a newly-created request, or re-initializes an existing one.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/open)
*/
open(method: string, url: string | URL): void;
open(method: string, url: string | URL, async: boolean, username?: string | null, password?: string | null): void;
Additional information about the issue
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels