Merge pull request #31187 from BendingBender/terminal-link

Add types for terminal-link
This commit is contained in:
Nathan Shively-Sanders
2018-12-17 15:51:34 -08:00
committed by GitHub
4 changed files with 56 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for terminal-link 1.1
// Project: https://github.com/sindresorhus/terminal-link#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = terminalLink;
declare function terminalLink(text: string, url: string, options?: terminalLink.Options): string;
declare namespace terminalLink {
function isSupported(): boolean;
interface Options {
fallback?: (text: string, url: string) => string;
}
}
@@ -0,0 +1,16 @@
import terminalLink = require('terminal-link');
// $ExpectType string
terminalLink('My Website', 'https://sindresorhus.com');
terminalLink('My Website', 'https://sindresorhus.com', {
fallback(text, url) {
// $ExpectType string
text;
// $ExpectType string
url;
return text;
},
});
// $ExpectType boolean
terminalLink.isSupported();
+23
View 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",
"terminal-link-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }