Merge pull request #31353 from BendingBender/shorten-repo-url

Add types for shorten-repo-url
This commit is contained in:
Nathan Shively-Sanders
2018-12-17 10:15:38 -08:00
committed by GitHub
4 changed files with 51 additions and 0 deletions
+12
View File
@@ -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');
+24
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }