DefinitelyTyped/types/url-parse/url-parse-tests.ts
Hari Sivaramakrishnan 9b1c19d214 [url-parse] Export URL definition in url-parse (#27125)
* Export URL in url-parse

* Add to definitions by list
2018-07-13 13:02:09 -07:00

19 lines
597 B
TypeScript

import parse = require("url-parse");
const url1 = new URL("foo/bar", "https://github.com/");
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;
url2.query.baz;
url3.slashes;
url3.set("protocol", "http://");
parse.extractProtocol("https://github.com/foo/bar");
parse.location("https://github.com/foo/bar");
parse.qs;