mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Add types for linkify-issues
This commit is contained in:
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for linkify-issues 1.3
|
||||
// Project: https://github.com/sindresorhus/linkify-issues#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = linkifyIssues;
|
||||
|
||||
declare function linkifyIssues(input: string, options?: linkifyIssues.TypeStringOptions): string;
|
||||
declare function linkifyIssues(
|
||||
input: string,
|
||||
options: linkifyIssues.TypeDomOptions
|
||||
): DocumentFragment;
|
||||
|
||||
declare namespace linkifyIssues {
|
||||
interface BaseOptions {
|
||||
user: string;
|
||||
repo: string;
|
||||
attributes?: { [attrName: string]: string | number | boolean | Array<string | number> };
|
||||
baseUrl?: string;
|
||||
}
|
||||
|
||||
interface TypeStringOptions extends BaseOptions {
|
||||
type?: 'string';
|
||||
}
|
||||
|
||||
interface TypeDomOptions extends BaseOptions {
|
||||
type: 'dom';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import linkifyIssues = require('linkify-issues');
|
||||
|
||||
// $ExpectType string
|
||||
linkifyIssues('Fixes #143 and avajs/ava#1023', {
|
||||
user: 'sindresorhus',
|
||||
repo: 'dofle',
|
||||
});
|
||||
// $ExpectType string
|
||||
linkifyIssues('Fixes #143 and avajs/ava#1023', {
|
||||
user: 'sindresorhus',
|
||||
repo: 'dofle',
|
||||
attributes: {
|
||||
class: 'unicorn',
|
||||
multiple: ['a', 'b'],
|
||||
number: 1,
|
||||
exclude: false,
|
||||
include: true,
|
||||
},
|
||||
});
|
||||
// $ExpectType string
|
||||
linkifyIssues('Fixes #143 and avajs/ava#1023', {
|
||||
user: 'sindresorhus',
|
||||
repo: 'dofle',
|
||||
type: 'string',
|
||||
});
|
||||
|
||||
const fragment = linkifyIssues('Fixes #143 and avajs/ava#1023', {
|
||||
user: 'sindresorhus',
|
||||
repo: 'dofle',
|
||||
type: 'dom',
|
||||
});
|
||||
|
||||
// $ExpectType DocumentFragment
|
||||
fragment;
|
||||
|
||||
document.body.appendChild(fragment);
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"linkify-issues-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user