add typings for slice-ansi package (#30423)

This commit is contained in:
dwieeb
2018-11-18 18:01:28 -08:00
committed by Pranav Senthilnathan
parent e372825f2e
commit f884416c05
4 changed files with 45 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for slice-ansi 2.0
// Project: https://github.com/chalk/slice-ansi#readme
// Definitions by: Dan Imhoff <https://github.com/dwieeb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function sliceAnsi(input: string, beginSlice: number, endSlice?: number): string;
export = sliceAnsi;
+13
View File
@@ -0,0 +1,13 @@
import sliceAnsi = require('slice-ansi');
// $ExpectType string
sliceAnsi('The quick brown \u001b[31mfox jumped over \u001b[39mthe lazy \u001b[32mdog and then ran away with the unicorn.\u001b[39m', 20, 30);
// $ExpectType string
sliceAnsi('test', 1);
// $ExpectError
sliceAnsi();
// $ExpectError
sliceAnsi(5);
+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",
"slice-ansi-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }