Skip to content

Commit 419d880

Browse files
authored
🤖 Merge PR DefinitelyTyped#72363 feat(git-url-parse,git-up): update types to match latest versions by @viceice
Signed-off-by: Michael Kriese <[email protected]>
1 parent 971210c commit 419d880

File tree

6 files changed

+32
-45
lines changed

6 files changed

+32
-45
lines changed

‎types/git-up/git-up-tests.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ type PU = gitUp.ParsedUrl;
55

66
const parsedUrl = gitUp("[email protected]:IonicaBizau/node-parse-url.git"); // $ExpectType ParsedUrl
77

8-
parsedUrl.protocols; // $ExpectType string[]
8+
parsedUrl.protocols; // $ExpectType Protocol[]
99
parsedUrl.port; // $ExpectType string
1010
parsedUrl.resource; // $ExpectType string
11-
parsedUrl.user; // $ExpectType string | undefined
11+
parsedUrl.user; // $ExpectType string
1212
parsedUrl.pathname; // $ExpectType string
1313
parsedUrl.hash; // $ExpectType string
1414
parsedUrl.search; // $ExpectType string
1515
parsedUrl.href; // $ExpectType string
16-
parsedUrl.protocol; // $ExpectType string
16+
parsedUrl.protocol; // $ExpectType Protocol
1717
parsedUrl.token; // $ExpectType string
1818
parsedUrl.query; // $ExpectType Record<string, string>
19-
parsedUrl.parse_failed; // $ExpectType false
19+
parsedUrl.parse_failed; // $ExpectType boolean

‎types/git-up/index.d.ts‎

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import parseUrl = require("parse-url");
2+
13
export = gitUp;
24

35
/**
@@ -12,7 +14,7 @@ export = gitUp;
1214
* console.log(gitUp("[email protected]:IonicaBizau/node-parse-url.git"));
1315
* // => {
1416
* // protocols: []
15-
* // , port: null
17+
* // , port: ""
1618
* // , resource: "github.com"
1719
* // , user: "git"
1820
* // , pathname: "/IonicaBizau/node-parse-url.git"
@@ -25,7 +27,7 @@ export = gitUp;
2527
* console.log(gitUp("https://github.com/IonicaBizau/node-parse-url.git"));
2628
* // => {
2729
* // protocols: [ "https" ]
28-
* // , port: null
30+
* // , port: ""
2931
* // , resource: "github.com"
3032
* // , user: ""
3133
* // , pathname: "/IonicaBizau/node-parse-url.git"
@@ -38,28 +40,14 @@ export = gitUp;
3840
declare function gitUp(input: string): gitUp.ParsedUrl;
3941

4042
declare namespace gitUp {
41-
interface ParsedUrl {
42-
/** An array with the url protocols (usually it has one element). */
43-
protocols: string[];
44-
/** The domain port. */
45-
port: string;
46-
/** The url domain (including subdomains). */
47-
resource: string;
48-
/** The authentication user (usually for ssh urls). */
49-
user: string | undefined;
50-
/** The url pathname. */
51-
pathname: string;
52-
/** The url hash. */
53-
hash: string;
54-
/** The url querystring value. */
55-
search: string;
56-
/** The input url. */
57-
href: string;
58-
/** The git url protocol. */
59-
protocol: string;
60-
/** The oauth token (could appear in the https urls). */
43+
interface ParsedUrl extends parseUrl.ParsedUrl {
44+
/**
45+
* The oauth token (could appear in the https urls).
46+
*
47+
* An empty string if not found.
48+
* Set from user if password is `x-oauth-basic`.
49+
* Set from password if user is `x-token-auth`.
50+
*/
6151
token: string;
62-
query: Record<string, string>;
63-
parse_failed: false;
6452
}
6553
}

‎types/git-up/package.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
22
"private": true,
33
"name": "@types/git-up",
4-
"version": "7.0.9999",
4+
"version": "8.0.9999",
55
"projects": [
66
"https://github.com/IonicaBizau/git-up"
77
],
8+
"dependencies": {
9+
"parse-url": "^9.2.0"
10+
},
811
"devDependencies": {
912
"@types/git-up": "workspace:."
1013
},

‎types/git-url-parse/git-url-parse-tests.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import gitUrlParse = require("git-url-parse");
33
gitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git"); // $ExpectType GitUrl
44
gitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git").toString(); // $ExpectType string
55
gitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git").toString("git+ssh"); // $ExpectType string
6+
gitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git").port; // $ExpectType string
7+
gitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git").user; // $ExpectType string
8+
gitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git").password; // $ExpectType string
9+
gitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git").token; // $ExpectType string
10+
gitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git").protocol; // $ExpectType Protocol
611

712
gitUrlParse.stringify(gitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git")); // $ExpectType string
813
gitUrlParse.stringify(gitUrlParse("[email protected]:IonicaBizau/node-git-url-parse.git"), "https"); // $ExpectType string

‎types/git-url-parse/index.d.ts‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1+
import gitUp = require("git-up");
2+
13
declare namespace gitUrlParse {
2-
interface GitUrl {
3-
/** An array with the url protocols (usually it has one element). */
4-
protocols: string[];
5-
port: number | null;
6-
/** The url domain (including subdomains). */
7-
resource: string;
8-
/** The authentication user (usually for ssh urls). */
9-
user: string;
10-
pathname: string;
11-
hash: string;
12-
search: string;
13-
href: string;
14-
protocol: string;
15-
/** The oauth token (could appear in the https urls). */
16-
token: string;
4+
interface GitUrl extends gitUp.ParsedUrl {
175
/** The Git provider (e.g. `"github.com"`). */
186
source: string;
197
/** The repository owner. */

‎types/git-url-parse/package.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
22
"private": true,
33
"name": "@types/git-url-parse",
4-
"version": "9.0.9999",
4+
"version": "16.0.9999",
55
"projects": [
66
"https://github.com/IonicaBizau/git-url-parse"
77
],
8+
"dependencies": {
9+
"@types/git-up": "^8.0.0"
10+
},
811
"devDependencies": {
912
"@types/git-url-parse": "workspace:."
1013
},

0 commit comments

Comments
 (0)