mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
[new-github-release-url] Add types
This commit is contained in:
63
types/new-github-release-url/index.d.ts
vendored
Normal file
63
types/new-github-release-url/index.d.ts
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
// Type definitions for new-github-release-url 0.1
|
||||
// Project: https://github.com/sindresorhus/new-github-release-url#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
export = newGithubReleaseUrl;
|
||||
|
||||
/**
|
||||
* Returns a URL string.
|
||||
*/
|
||||
declare function newGithubReleaseUrl(options: newGithubReleaseUrl.Options): string;
|
||||
|
||||
declare namespace newGithubReleaseUrl {
|
||||
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
|
||||
type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
|
||||
|
||||
type Options = XOR<RepoUrlOptions, UserRepoOptions>;
|
||||
|
||||
interface BaseOptions {
|
||||
/**
|
||||
* The tag name of the release.
|
||||
*/
|
||||
tag?: string;
|
||||
/**
|
||||
* The branch name or commit SHA to point the release's tag at, if the tag doesn't already exist.
|
||||
* @default The default branch
|
||||
*/
|
||||
target?: string;
|
||||
/**
|
||||
* The title of the release.
|
||||
* GitHub shows the `tag` name when not specified.
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* The description text of the release.
|
||||
*/
|
||||
body?: string;
|
||||
/**
|
||||
* Whether the release should be marked as a pre-release.
|
||||
* @default false
|
||||
*/
|
||||
isPrerelease?: boolean;
|
||||
}
|
||||
|
||||
interface RepoUrlOptions extends BaseOptions {
|
||||
/**
|
||||
* The full URL to the repo.
|
||||
*/
|
||||
repoUrl: string;
|
||||
}
|
||||
|
||||
interface UserRepoOptions extends BaseOptions {
|
||||
/**
|
||||
* GitHub username or organization.
|
||||
*/
|
||||
user: string;
|
||||
/**
|
||||
* GitHub repo.
|
||||
*/
|
||||
repo: string;
|
||||
}
|
||||
}
|
||||
44
types/new-github-release-url/new-github-release-url-tests.ts
Normal file
44
types/new-github-release-url/new-github-release-url-tests.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import newGithubReleaseUrl = require('new-github-release-url');
|
||||
|
||||
// $ExpectType string
|
||||
newGithubReleaseUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubReleaseUrl({
|
||||
user: 'sindresorhus',
|
||||
repo: 'new-github-release-url',
|
||||
});
|
||||
// $ExpectError
|
||||
newGithubReleaseUrl({
|
||||
user: 'sindresorhus',
|
||||
});
|
||||
// $ExpectError
|
||||
newGithubReleaseUrl({
|
||||
repo: 'new-github-release-url',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubReleaseUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
tag: 'foo',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubReleaseUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
target: 'foo',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubReleaseUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
title: 'foo',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubReleaseUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
body: 'foo',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubReleaseUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
isPrerelease: true,
|
||||
});
|
||||
23
types/new-github-release-url/tsconfig.json
Normal file
23
types/new-github-release-url/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"new-github-release-url-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/new-github-release-url/tslint.json
Normal file
1
types/new-github-release-url/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user