Skip to content

Commit

Permalink
refactor(node): tweak up URL global type after tsc manual tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Jan 19, 2022
1 parent 11fc7f5 commit 0ac59f6
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 33 deletions.
30 changes: 18 additions & 12 deletions types/node/url.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,22 +858,28 @@ declare module 'url' {

import { URL as _URL, URLSearchParams as _URLSearchParams } from 'url';
global {
interface URLSearchParams extends _URLSearchParams {}
interface URL extends _URL {}
interface Global {
/**
* `URL` class is global.
* https://nodejs.org/api/url.html#the-whatwg-url-api
* @since v10.0.0
*/
URL: typeof _URL;
/**
* `URLSearchParams` class is global.
* https://nodejs.org/api/url.html#class-urlsearchparams
* @since v10.0.0
*/
URLSearchParams: typeof _URLSearchParams;
}
interface URLSearchParams extends _URLSearchParams {}
interface URL extends _URL {}
/**
* `URL` class is global.
* https://nodejs.org/api/url.html#the-whatwg-url-api
* @since v10.0.0
*/
var URL: typeof globalThis extends { webkitURL: infer URL } ? URL : typeof _URL;
/**
* `URLSearchParams` class is global.
* 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;
};
}
}
declare module 'node:url' {
Expand Down
28 changes: 21 additions & 7 deletions types/node/v12/url.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,27 @@ declare module 'url' {

import { URL as _URL, URLSearchParams as _URLSearchParams } from 'url';
global {
namespace NodeJS {
interface Global {
URL: typeof _URL;
URLSearchParams: typeof _URLSearchParams;
}
interface URLSearchParams extends _URLSearchParams {}
interface URL extends _URL {}
interface URLSearchParams extends _URLSearchParams {}
interface URL extends _URL {}
interface Global {
URL: typeof _URL;
URLSearchParams: typeof _URLSearchParams;
}
/**
* `URL` class is global.
* https://nodejs.org/api/url.html#the-whatwg-url-api
* @since v10.0.0
*/
var URL: typeof globalThis extends { webkitURL: infer URL } ? URL : typeof _URL;
/**
* `URLSearchParams` class is global.
* 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;
};
}
}
20 changes: 18 additions & 2 deletions types/node/v14/url.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,28 @@ declare module 'url' {

import { URL as _URL, URLSearchParams as _URLSearchParams } from 'url';
global {
interface URLSearchParams extends _URLSearchParams {}
interface URL extends _URL {}
interface Global {
URL: typeof _URL;
URLSearchParams: typeof _URLSearchParams;
}
interface URLSearchParams extends _URLSearchParams {}
interface URL extends _URL {}
/**
* `URL` class is global.
* https://nodejs.org/api/url.html#the-whatwg-url-api
* @since v10.0.0
*/
var URL: typeof globalThis extends { webkitURL: infer URL } ? URL : typeof _URL;
/**
* `URLSearchParams` class is global.
* 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;
};
}
}
declare module 'node:url' {
Expand Down
30 changes: 18 additions & 12 deletions types/node/v16/url.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -818,22 +818,28 @@ declare module 'url' {

import { URL as _URL, URLSearchParams as _URLSearchParams } from 'url';
global {
interface URLSearchParams extends _URLSearchParams {}
interface URL extends _URL {}
interface Global {
/**
* `URL` class is global.
* https://nodejs.org/api/url.html#the-whatwg-url-api
* @since v10.0.0
*/
URL: typeof _URL;
/**
* `URLSearchParams` class is global.
* https://nodejs.org/api/url.html#class-urlsearchparams
* @since v10.0.0
*/
URLSearchParams: typeof _URLSearchParams;
}
interface URLSearchParams extends _URLSearchParams {}
interface URL extends _URL {}
/**
* `URL` class is global.
* https://nodejs.org/api/url.html#the-whatwg-url-api
* @since v10.0.0
*/
var URL: typeof globalThis extends { webkitURL: infer URL } ? URL : typeof _URL;
/**
* `URLSearchParams` class is global.
* 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;
};
}
}
declare module 'node:url' {
Expand Down

0 comments on commit 0ac59f6

Please sign in to comment.