diff --git a/types/react-native/globals.d.ts b/types/react-native/globals.d.ts index 7f27293b5b..319b9dd34a 100644 --- a/types/react-native/globals.d.ts +++ b/types/react-native/globals.d.ts @@ -251,3 +251,24 @@ declare var XMLHttpRequestUpload: { }; declare type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text"; + +/** + * Based on definitions of lib.dom and lib.dom.iteralbe + */ +declare class URLSearchParams { + constructor(init?: string[][] | Record | string | URLSearchParams); + + append(name: string, value: string): void; + 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; + forEach(callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any): void; + [Symbol.iterator](): IterableIterator<[string, string]>; + + entries(): IterableIterator<[string, string]>; + keys(): IterableIterator; + values(): IterableIterator; +} diff --git a/types/react-native/test/globals.tsx b/types/react-native/test/globals.tsx index a2fdf241a5..16dd3cf977 100644 --- a/types/react-native/test/globals.tsx +++ b/types/react-native/test/globals.tsx @@ -34,3 +34,5 @@ xmlRequest.addEventListener("load", (ev) => { console.log(ev.loaded) console.log(ev.total) }); + +const test = new URLSearchParams();