Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URLSearchParams #48142

Closed
nmaves opened this issue Mar 6, 2022 · 2 comments
Closed

URLSearchParams #48142

nmaves opened this issue Mar 6, 2022 · 2 comments

Comments

@nmaves
Copy link

nmaves commented Mar 6, 2022

I feel like this might be missing a type. Per the MDN docs on URLSearchParams you should be able to initialize it with a FormData. I believe that we might want to add Iterable<[string, string]> or even just FormData to the allowed init types.

The code actually works but the types are not allowed. In your console, the following code works.

let formData = new FormData()
let urlSearchParams = new UrlSearchParams(formData)

TypeScript/lib/lib.dom.d.ts

Lines 14942 to 14946 in 20c93d3

declare var URLSearchParams: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};

@MartinJohns
Copy link
Contributor

  1. You forgot to fill out the issue template.
  2. See the discussions in allow constructing URLSearchParams directly from FormData #30584. FormData includes File, which would not be valid.
  3. You might want to follow fix: add FormData to URLSearchParams constructor TypeScript-DOM-lib-generator#880.

@nmaves
Copy link
Author

nmaves commented Mar 7, 2022

Closing as there are other issues that are tracking this.

@nmaves nmaves closed this as completed Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants