mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #31187 from BendingBender/terminal-link
Add types for terminal-link
This commit is contained in:
Vendored
+16
@@ -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();
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user