Hi,
I opened this PR (microsoft/TypeScript#30512) to make the following code compilable with TypeScript:
const url = new URL(location.href)
url.search = '?foo=bar'
history.pushState({}, 'Title', url)
The following code is working, (you can try it in your console, it will append ?foo=bar to the URL), but we can't compile it with TypeScript:

The current signature is
replaceState(data: any, title: string, url?: string | null): void;
and I want to update it to:
replaceState(data: any, title: string, url?: string | URL | null): void;
So as @typescript-bot said (microsoft/TypeScript#30512 (comment)), I should open a PR here but I don't know what to update.
After some research, replaceState appears three times in the following files:
dom.generated.d.ts, but I should not update this file manually because it's auto-generated
browser.webidl.preprocessed.json, I should not update it either
HTML - Session history and navigation.widl, but the signature is void replaceState(any data, DOMString title, optional USVString? url = null) and I don't understand how optional USVString? url = null is transformed to url?: string | null 🤔
Even in the overridingTypes.json file, I don't see any pushState() / replaceState() 😕
So what should I do to make replaceState() and pushState() accepts an URL instance as the 3rd parameter?
Thanks! :)
Hi,
I opened this PR (microsoft/TypeScript#30512) to make the following code compilable with TypeScript:
The following code is working, (you can try it in your console, it will append

?foo=barto the URL), but we can't compile it with TypeScript:The current signature is
and I want to update it to:
So as @typescript-bot said (microsoft/TypeScript#30512 (comment)), I should open a PR here but I don't know what to update.
After some research,
replaceStateappears three times in the following files:dom.generated.d.ts, but I should not update this file manually because it's auto-generatedbrowser.webidl.preprocessed.json, I should not update it eitherHTML - Session history and navigation.widl, but the signature isvoid replaceState(any data, DOMString title, optional USVString? url = null)and I don't understand howoptional USVString? url = nullis transformed tourl?: string | null🤔Even in the
overridingTypes.jsonfile, I don't see anypushState()/replaceState()😕So what should I do to make
replaceState()andpushState()accepts anURLinstance as the 3rd parameter?Thanks! :)