Skip to content

Conversation

@Abhi3975
Copy link

@Abhi3975 Abhi3975 commented Dec 1, 2025

Fix #54733: Add missing URLSearchParams type definitions

Summary

This PR fixes issue #54733 where the TypeScript definitions for URLSearchParams in globals.d.ts were missing several methods that were recently implemented in the codebase (commit af1f1e4).

The following methods have been added to the URLSearchParams interface to match the implementation:

  • delete(name: string): void
  • get(name: string): string | null
  • getAll(name: string): string[]
  • has(name: string): boolean
  • set(name: string, value: string): void
  • sort(): void
  • keys(): IterableIterator<string>
  • values(): IterableIterator<string>
  • entries(): IterableIterator<[string, string]>
  • forEach(callbackfn, thisArg?): void

Changelog

[General] [Fixed] - Add missing URLSearchParams type definitions to globals.d.ts

Test Plan

This is a type definition change only. It allows TypeScript to correctly validate usage of the newly implemented URLSearchParams methods.

Verification:

  1. Create a URLSearchParams instance.
  2. Use any of the newly typed methods (e.g., params.get('foo')).
  3. Verify that TypeScript no longer reports property does not exist errors.
const params = new URLSearchParams('foo=bar');
const value = params.get('foo'); // Should not error
params.set('baz', 'qux'); // Should not error
params.forEach((value, key) => console.log(key, value)); // Should not error

Fixes #54733

After the implementation of URLSearchParams methods in commit af1f1e4,
the TypeScript definitions in globals.d.ts were not updated to reflect
the new methods. This caused TypeScript errors when using methods like
get(), getAll(), has(), set(), delete(), sort(), keys(), values(),
entries(), and forEach() on URLSearchParams instances.

This commit adds all missing method signatures to the URLSearchParams
interface to match the implementation:
- delete(name: string): void
- get(name: string): string | null
- getAll(name: string): string[]
- has(name: string): boolean
- set(name: string, value: string): void
- sort(): void
- keys(): IterableIterator<string>
- values(): IterableIterator<string>
- entries(): IterableIterator<[string, string]>
- forEach(callbackfn, thisArg?): void

Fixes facebook#54733
@meta-cla
Copy link

meta-cla bot commented Dec 1, 2025

Hi @Abhi3975!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@meta-cla
Copy link

meta-cla bot commented Dec 1, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 1, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Dec 1, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 5, 2025

@alanleedev has imported this pull request. If you are a Meta employee, you can view this in D88511249.

@alanleedev
Copy link
Contributor

Next time, please don't mess with the formatting on the code that you did not change.

@alanleedev
Copy link
Contributor

Sorry, I'm gonna close this in favor of PR #54787 which is more clean and also add additional missing type defs

@alanleedev alanleedev closed this Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect typing on URL / URLSearchParams

3 participants