Closed
Description
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-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 = null
is transformed tourl?: 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! :)
Metadata
Metadata
Assignees
Labels
No labels