Skip to content

URLSearchParams should accept an iterable #741

Open
@fregante

Description

@fregante

This works in the browser, but the TS definition doesn't allow it:

new URLSearchParams(new FormData(document.querySelector('form')));

The type is currently:

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

The specification says that it should accept a "sequence", not specifically an array https://url.spec.whatwg.org/#concept-urlsearchparams-new

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions