mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[url-parse] Export URL definition in url-parse (#27125)
* Export URL in url-parse * Add to definitions by list
This commit is contained in:
parent
b2b13c6fb0
commit
9b1c19d214
43
types/url-parse/index.d.ts
vendored
43
types/url-parse/index.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
// Type definitions for url-parse 1.1
|
||||
// Project: https://github.com/unshiftio/url-parse
|
||||
// Definitions by: Pavlo Chernenko <https://github.com/ChernenkoPaul>
|
||||
// Hari Sivaramakrishnan <https://github.com/harisiva>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@ -8,28 +9,30 @@ import URLSearchParams = require("url-search-params");
|
||||
|
||||
type UrlQueryParamsParser = (url: string) => string;
|
||||
|
||||
declare class URL {
|
||||
readonly auth: string;
|
||||
readonly hash: string;
|
||||
readonly host: string;
|
||||
readonly hostname: string;
|
||||
readonly href: string;
|
||||
readonly origin: string;
|
||||
readonly password: string;
|
||||
readonly pathname: string;
|
||||
readonly port: string;
|
||||
readonly protocol: string;
|
||||
query: { [key: string]: string | undefined };
|
||||
readonly search: string;
|
||||
set(property: string, value: string | object | number | undefined): URL;
|
||||
readonly slashes: boolean;
|
||||
readonly username: string;
|
||||
readonly searchParams: URLSearchParams;
|
||||
toString(): string;
|
||||
declare namespace parse {
|
||||
interface URL {
|
||||
readonly auth: string;
|
||||
readonly hash: string;
|
||||
readonly host: string;
|
||||
readonly hostname: string;
|
||||
readonly href: string;
|
||||
readonly origin: string;
|
||||
readonly password: string;
|
||||
readonly pathname: string;
|
||||
readonly port: string;
|
||||
readonly protocol: string;
|
||||
query: { [key: string]: string | undefined };
|
||||
readonly search: string;
|
||||
set(property: string, value: string | object | number | undefined): URL;
|
||||
readonly slashes: boolean;
|
||||
readonly username: string;
|
||||
readonly searchParams: URLSearchParams;
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
|
||||
type ParseFunctionNodeType = (url: string, parseQueryString?: boolean, slashesDenoteHost?: boolean) => URL;
|
||||
type ParseFunctionType = (url: string, baseURL?: object | string, parser?: boolean | UrlQueryParamsParser) => URL;
|
||||
type ParseFunctionNodeType = (url: string, parseQueryString?: boolean, slashesDenoteHost?: boolean) => parse.URL;
|
||||
type ParseFunctionType = (url: string, baseURL?: object | string, parser?: boolean | UrlQueryParamsParser) => parse.URL;
|
||||
|
||||
interface Protocol {
|
||||
slashes: boolean;
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import parse = require("url-parse");
|
||||
|
||||
const url1 = new URL("foo/bar", "https://github.com/");
|
||||
const url2 = parse("https://github.com/foo/bar?baz=true");
|
||||
const url3 = parse("https://github.com/foo/bar", true, true);
|
||||
const url4 = parse("foo/bar", "https://github.com/");
|
||||
const url5 = parse("foo/bar", "https://github.com/", () => "queryParserOverride");
|
||||
const url2: parse.URL = parse("https://github.com/foo/bar?baz=true");
|
||||
const url3: parse.URL = parse("https://github.com/foo/bar", true, true);
|
||||
const url4: parse.URL = parse("foo/bar", "https://github.com/");
|
||||
const url5: parse.URL = parse("foo/bar", "https://github.com/", () => "queryParserOverride");
|
||||
|
||||
url2.hash;
|
||||
url2.hostname;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user