mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-01-30 13:37:35 +00:00
Merge pull request #32009 from BendingBender/new-github-issue-url
[new-github-issue-url] Add types
This commit is contained in:
commit
3449e8ee0b
81
types/new-github-issue-url/index.d.ts
vendored
Normal file
81
types/new-github-issue-url/index.d.ts
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
// Type definitions for new-github-issue-url 0.1
|
||||
// Project: https://github.com/sindresorhus/new-github-issue-url#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
export = newGithubIssueUrl;
|
||||
|
||||
/**
|
||||
* Returns a URL string.
|
||||
*/
|
||||
declare function newGithubIssueUrl(options: newGithubIssueUrl.Options): string;
|
||||
|
||||
declare namespace newGithubIssueUrl {
|
||||
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 issue body.
|
||||
*/
|
||||
body?: string;
|
||||
/**
|
||||
* The issue title.
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* Use an [issue template](https://help.github.com/articles/manually-creating-a-single-issue-template-for-your-repository).
|
||||
*
|
||||
* For example, if you want to use a template at `ISSUE_TEMPLATE/unicorn.md`, you would specify `unicorn.md` here.
|
||||
*/
|
||||
template?: string;
|
||||
/**
|
||||
* The labels for the issue.
|
||||
*
|
||||
* *Requires the user to have the permission to add labels.*
|
||||
*/
|
||||
labels?: string[];
|
||||
/**
|
||||
* The milestone for the issue.
|
||||
*
|
||||
* *Requires the user to have the permission to add milestone.*
|
||||
*/
|
||||
milestone?: string;
|
||||
/**
|
||||
* The user to assign to the issue.
|
||||
*
|
||||
* *Requires the user to have the permission to add assignee.*
|
||||
*/
|
||||
assignee?: string;
|
||||
/**
|
||||
* The projects to add the issue to.
|
||||
*
|
||||
* The project reference format is `user/<project-number>`, for example, if the URL to the project
|
||||
* is `https://github.com/sindresorhus/some-repo/projects/3`, the project reference would be `some-repo/3`.
|
||||
*
|
||||
* *Requires the user to have the permission to add projects.*
|
||||
*/
|
||||
projects?: string[];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
54
types/new-github-issue-url/new-github-issue-url-tests.ts
Normal file
54
types/new-github-issue-url/new-github-issue-url-tests.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import newGithubIssueUrl = require('new-github-issue-url');
|
||||
|
||||
// $ExpectType string
|
||||
newGithubIssueUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-issue-url.git',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubIssueUrl({
|
||||
user: 'sindresorhus',
|
||||
repo: 'new-github-issue-url',
|
||||
});
|
||||
// $ExpectError
|
||||
newGithubIssueUrl({
|
||||
user: 'sindresorhus',
|
||||
});
|
||||
// $ExpectError
|
||||
newGithubIssueUrl({
|
||||
repo: 'new-github-issue-url',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubIssueUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
body: 'foo',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubIssueUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
title: 'foo',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubIssueUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
template: 'unicorn.md',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubIssueUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
labels: ['foo', 'bar'],
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubIssueUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
milestone: 'foo',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubIssueUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
assignee: 'sindresorhus',
|
||||
});
|
||||
// $ExpectType string
|
||||
newGithubIssueUrl({
|
||||
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
|
||||
projects: ['some-repo/3'],
|
||||
});
|
||||
23
types/new-github-issue-url/tsconfig.json
Normal file
23
types/new-github-issue-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-issue-url-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/new-github-issue-url/tslint.json
Normal file
1
types/new-github-issue-url/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user