Created
June 6, 2016 15:00
-
-
Save Jason-Rev/db690a4a511d571203f02517ec1f7480 to your computer and use it in GitHub Desktop.
Typings for npm url-parse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'url-parse' { | |
interface Query { | |
[index: string]: string; | |
} | |
interface QueryParser { | |
(query: string): any; | |
} | |
interface ParsedUrl { | |
(url: string, baseURL?: string, parseQuery?: boolean|QueryParser): ParsedUrl; | |
new (url: string, baseURL?: string, parseQuery?: boolean|QueryParser): ParsedUrl; | |
protocol: string; // protocol: Requested protocol without slashes (e.g. http:). | |
username: string; // username: Username of basic authentication. | |
password: string; // password: Password of basic authentication. | |
auth: string; // auth: Authentication information portion (e.g. username:password). | |
host: string; // host: Host name with port number. | |
hostname: string; // hostname: Host name without port number. | |
port: number; // port: Optional port number. | |
pathname: string; // pathname: URL path. | |
query: Query; // query: Parsed object containing query string, unless parsing is set to false. | |
hash: string; // hash: The "fragment" portion of the URL including the pound-sign (#). | |
href: string; // href: The full URL. | |
toString(): string; | |
set(key: string, value: string|Object|number); | |
} | |
const URL: ParsedUrl; | |
export = URL; | |
} |
Also line 20 (port
) should be a string
, not a number
, based on what the library actually returns.
I've updated it in my fork.
Also, on line 27, set()
returns ParsedUrl
. Also updated in my fork.
@Jason-Rev would you be willing to release this under the MIT license? If so, I can pull it into https://github.com/DefinitelyTyped/DefinitelyTyped and get it up on NPM for you.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Jason-Rev would you be willing to submit this to https://github.com/DefinitelyTyped/DefinitelyTyped ?