[cli-cursor] Add types

This commit is contained in:
Dimitri Benin
2018-12-24 18:47:59 +01:00
parent 42e3741a35
commit 33b53365ad
4 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import { show, hide, toggle } from 'cli-cursor';
hide();
hide(process.stderr);
show();
show(process.stderr);
toggle();
toggle(false);
toggle(false, process.stderr);

28
types/cli-cursor/index.d.ts vendored Normal file
View File

@@ -0,0 +1,28 @@
// Type definitions for cli-cursor 2.1
// Project: https://github.com/sindresorhus/cli-cursor#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/**
* Show cursor.
*
* @param stream defaults to `process.stderr`
*/
export function show(stream?: NodeJS.WritableStream): void;
/**
* Hide cursor.
*
* @param stream defaults to `process.stderr`
*/
export function hide(stream?: NodeJS.WritableStream): void;
/**
* Toggle cursor visibility.
*
* @param force is useful to show or hide the cursor based on a boolean.
* @param stream defaults to `process.stderr`
*/
export function toggle(force?: boolean, stream?: NodeJS.WritableStream): void;

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",
"cli-cursor-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }