forked from knowledgesystems/signal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurl.d.ts
38 lines (33 loc) · 1.16 KB
/
url.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
declare module 'url'
{
export type QueryParams = { [key:string]: undefined | null | string | string[] };
export interface URLParts
{
auth: string | null;
hash: string | null;
host: string | null;
hostname: string | null;
href: string;
path: string | null;
pathname: string | null;
port: string | null;
protocol: string | null;
query: string | QueryParams | null;
search: string | null;
slashes: true | null;
}
export type URLFormatParams = {
auth?: string;
hash?: string;
pathname?: string;
protocol?: string;
} & (
{host?: string} | {hostname?: string, port?: string}
) & (
{search?: string} | {query?: QueryParams}
);
export function parse(urlStr:string, parseQueryString:true, slashesDenoteHost?:boolean):URLParts & {query: QueryParams, search: string};
export function parse(urlStr:string, parseQueryString?:false, slashesDenoteHost?:boolean):URLParts & {query: string | null};
export function format(urlObj:URLFormatParams):string;
export function resolve(from:string, to:string):string;
}