[hosted-git-info] Update types for 3.0 (#42499)

Not exactly sure where the original author got `host` from but from what I can
see it's always been `type`.

Also remove `fromUrl` from the class as it's not actually a part of the class
This commit is contained in:
Michael Mitchell 2020-02-26 06:02:14 +11:00 committed by GitHub
parent c0824717e9
commit a6c082f346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,82 +1,61 @@
// Type definitions for hosted-git-info 2.7
// Type definitions for hosted-git-info 3.0
// Project: https://github.com/npm/hosted-git-info
// Definitions by: Jason <https://github.com/OiyouYeahYou>
// Definitions by: Jason <https://github.com/OiyouYeahYou>, Michael <https://github.com/Ovyerus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class HostedGitInfo {
host: HostedGitInfo.hosts;
user: string | null;
auth: string | null;
project: string | null;
committish: string | null;
declare class GitHost {
constructor(type: GitHost.Hosts, user: string, auth: string | undefined, project: string, committish: string | undefined, defaultRepresentation: string, opts?: GitHost.FillOptions);
type: GitHost.Hosts;
user: string;
auth?: string;
project: string;
committish?: string;
default: string;
opts: HostedGitInfo.Options;
opts: GitHost.Options;
protocols: string[];
domain: string;
treepath?: string;
constructor(
host: HostedGitInfo.hosts,
user: string | null,
auth: string | null,
project: string | null,
committish: string | null,
defaultRepresentation: string,
opts?: HostedGitInfo.Options
);
// From git-host-info
// defaults
// Templates
sshtemplate: string;
sshurltemplate: string;
browsetemplate: string;
browsefiletemplate: string;
docstemplate: string;
httpstemplate: string;
filetemplate: string;
shortcuttemplate: string;
pathtemplate: string;
bugstemplate: string;
gittemplate?: string;
tarballtemplate: string;
pathmatch: RegExp;
protocols_re: RegExp;
hashformat(fragment: string): string;
// special
protocols: string[];
domain: string;
bugstemplate: string;
gittemplate: string;
browsefiletemplate: string;
httpstemplate: string;
treepath: string;
tarballtemplate: string;
// /From git-host-info
hash(): string;
ssh(opts?: HostedGitInfo.FillOptions): string | undefined;
sshurl(opts?: HostedGitInfo.FillOptions): string | undefined;
browse(
path: string,
fragment: string,
opts?: HostedGitInfo.FillOptions
): string | undefined;
browse(path: string, opts?: HostedGitInfo.FillOptions): string | undefined;
browse(opts?: HostedGitInfo.FillOptions): string | undefined;
docs(opts?: HostedGitInfo.FillOptions): string | undefined;
bugs(opts?: HostedGitInfo.FillOptions): string | undefined;
https(opts?: HostedGitInfo.FillOptions): string | undefined;
git(opts?: HostedGitInfo.FillOptions): string | undefined;
shortcut(opts?: HostedGitInfo.FillOptions): string | undefined;
path(opts?: HostedGitInfo.FillOptions): string | undefined;
tarball(opts?: HostedGitInfo.FillOptions): string | undefined;
file(path: string, opts?: HostedGitInfo.FillOptions): string | undefined;
ssh(opts?: GitHost.FillOptions): string;
sshurl(opts?: GitHost.FillOptions): string;
browse(opts?: GitHost.FillOptions): string;
browse(path: string, opts?: GitHost.FillOptions): string;
browse(path: string, fragment: string, opts?: GitHost.FillOptions): string;
docs(opts?: GitHost.FillOptions): string;
bugs(opts?: GitHost.FillOptions): string;
https(opts?: GitHost.FillOptions): string;
git(opts?: GitHost.FillOptions): string;
shortcut(opts?: GitHost.FillOptions): string;
path(opts?: GitHost.FillOptions): string;
tarball(opts?: GitHost.FillOptions): string;
file(path: string, opts?: GitHost.FillOptions): string;
getDefaultRepresentation(): string;
toString(opts?: HostedGitInfo.FillOptions): string | undefined;
static fromUrl(
gitUrl: string,
options?: HostedGitInfo.Options
): HostedGitInfo;
toString(opts?: GitHost.FillOptions): string;
}
declare namespace HostedGitInfo {
declare namespace GitHost {
function fromUrl(gitUrl: string, opts?: Options): GitHost;
interface Options {
noCommittish?: boolean;
noGitPlus?: boolean;
@ -90,7 +69,7 @@ declare namespace HostedGitInfo {
treepath?: string;
}
type hosts = 'github' | 'bitbucket' | 'gitlab' | 'gist';
type Hosts = 'github' | 'bitbucket' | 'gitlab' | 'gist';
}
export = HostedGitInfo;
export = GitHost;