mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #31353 from BendingBender/shorten-repo-url
Add types for shorten-repo-url
This commit is contained in:
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for shorten-repo-url 1.5
|
||||
// Project: https://github.com/bfred-it/shorten-repo-url#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = shortenRepoUrl;
|
||||
|
||||
declare function shortenRepoUrl(url: string, currentUrl?: string): string;
|
||||
|
||||
declare namespace shortenRepoUrl {
|
||||
function applyToLink(link: HTMLAnchorElement, currentUrl?: string): boolean;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import shortenRepoUrl = require('shorten-repo-url');
|
||||
|
||||
// $ExpectType string
|
||||
shortenRepoUrl('https://github.com/nodejs/node/tree/v0.12/doc', 'https://github.com/nodejs/node');
|
||||
// $ExpectType string
|
||||
shortenRepoUrl('https://github.com/nodejs/node/tree/v0.12/doc');
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.setAttribute('href', 'https://github.com/nodejs/node/tree/v0.12/doc');
|
||||
|
||||
// $ExpectType boolean
|
||||
shortenRepoUrl.applyToLink(link);
|
||||
// $ExpectType boolean
|
||||
shortenRepoUrl.applyToLink(link, 'https://github.com/nodejs/node');
|
||||
@@ -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",
|
||||
"shorten-repo-url-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user