Skip to content

Commit ef07c54

Browse files
committed
Merge branch 'improve-ts-types' of github.com:BendingBender/parse-url into new-version
2 parents 6563a56 + e16fd98 commit ef07c54

File tree

5 files changed

+2144
-22
lines changed

5 files changed

+2144
-22
lines changed

index.d.mts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import parseUrl = require("./index");
2+
3+
export type ParsedUrl = parseUrl.ParsedUrl;
4+
export type NormalizeOptions = parseUrl.NormalizeOptions;
5+
export type ParsingError = parseUrl.ParsingError;
6+
7+
export default parseUrl;

index.d.ts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
declare interface ParsedUrl {
2-
protocols: string[];
3-
protocol: string;
4-
port?: string;
5-
resource: string;
6-
user: string;
7-
pathname: string;
8-
hash: string;
9-
search: string;
10-
href: string;
11-
query: {
12-
[key: string]: any;
13-
}
1+
import parsePath = require("parse-path");
2+
import normalizeUrl = require("normalize-url");
3+
4+
declare namespace parseUrl {
5+
const MAX_INPUT_LENGTH: 2048;
6+
7+
type NormalizeOptions = normalizeUrl.Options;
8+
9+
type ParsedUrl = parsePath.ParsedPath;
10+
11+
interface ParsingError extends Error {
12+
readonly subject_url: string;
13+
}
1414
}
1515

16-
declare function parseUrl(url: string, normalize?: boolean | Object): ParsedUrl;
16+
declare function parseUrl(
17+
url: string,
18+
normalize?: boolean | parseUrl.NormalizeOptions
19+
): parseUrl.ParsedUrl;
1720

18-
export = parseUrl
21+
export = parseUrl;

0 commit comments

Comments
 (0)