Skip to content

Commit

Permalink
fix(node): fix global URLSearchParams var type for TS 3.7.x compatibi…
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Feb 3, 2022
1 parent 6c720eb commit 69cfafd
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 20 deletions.
15 changes: 10 additions & 5 deletions types/node/url.d.ts
Expand Up @@ -875,11 +875,16 @@ declare module 'url' {
* https://nodejs.org/api/url.html#class-urlsearchparams
* @since v10.0.0
*/
var URLSearchParams: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};
var URLSearchParams: typeof globalThis extends { SpeechRecognitionError: infer SpeechRecognitionError } ?
// For TS <= 3.8.2 compatibility
{
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
}: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};
}
}
declare module 'node:url' {
Expand Down
15 changes: 10 additions & 5 deletions types/node/v12/url.d.ts
Expand Up @@ -134,10 +134,15 @@ declare module 'url' {
* https://nodejs.org/api/url.html#class-urlsearchparams
* @since v10.0.0
*/
var URLSearchParams: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};
var URLSearchParams: typeof globalThis extends { SpeechRecognitionError: infer SpeechRecognitionError } ?
// For TS <= 3.8.2 compatibility
{
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
}: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};
}
}
15 changes: 10 additions & 5 deletions types/node/v14/url.d.ts
Expand Up @@ -133,11 +133,16 @@ declare module 'url' {
* https://nodejs.org/api/url.html#class-urlsearchparams
* @since v10.0.0
*/
var URLSearchParams: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};
var URLSearchParams: typeof globalThis extends { SpeechRecognitionError: infer SpeechRecognitionError } ?
// For TS <= 3.8.2 compatibility
{
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
}: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};
}
}
declare module 'node:url' {
Expand Down
15 changes: 10 additions & 5 deletions types/node/v16/url.d.ts
Expand Up @@ -835,11 +835,16 @@ declare module 'url' {
* https://nodejs.org/api/url.html#class-urlsearchparams
* @since v10.0.0
*/
var URLSearchParams: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};
var URLSearchParams: typeof globalThis extends { SpeechRecognitionError: infer SpeechRecognitionError } ?
// For TS <= 3.8.2 compatibility
{
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
}: {
prototype: URLSearchParams;
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
toString(): string;
};
}
}
declare module 'node:url' {
Expand Down

0 comments on commit 69cfafd

Please sign in to comment.