diff --git a/types/shorten-repo-url/index.d.ts b/types/shorten-repo-url/index.d.ts new file mode 100644 index 0000000000..94fc3a6836 --- /dev/null +++ b/types/shorten-repo-url/index.d.ts @@ -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 +// 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; +} diff --git a/types/shorten-repo-url/shorten-repo-url-tests.ts b/types/shorten-repo-url/shorten-repo-url-tests.ts new file mode 100644 index 0000000000..8ff67ba9d2 --- /dev/null +++ b/types/shorten-repo-url/shorten-repo-url-tests.ts @@ -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'); diff --git a/types/shorten-repo-url/tsconfig.json b/types/shorten-repo-url/tsconfig.json new file mode 100644 index 0000000000..8b9890cac7 --- /dev/null +++ b/types/shorten-repo-url/tsconfig.json @@ -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" + ] +} diff --git a/types/shorten-repo-url/tslint.json b/types/shorten-repo-url/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/shorten-repo-url/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }