From 33b53365ada7b666ca50ecad13ca2d24ff6e8513 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Mon, 24 Dec 2018 18:47:59 +0100 Subject: [PATCH] [cli-cursor] Add types --- types/cli-cursor/cli-cursor-tests.ts | 11 +++++++++++ types/cli-cursor/index.d.ts | 28 ++++++++++++++++++++++++++++ types/cli-cursor/tsconfig.json | 23 +++++++++++++++++++++++ types/cli-cursor/tslint.json | 1 + 4 files changed, 63 insertions(+) create mode 100644 types/cli-cursor/cli-cursor-tests.ts create mode 100644 types/cli-cursor/index.d.ts create mode 100644 types/cli-cursor/tsconfig.json create mode 100644 types/cli-cursor/tslint.json diff --git a/types/cli-cursor/cli-cursor-tests.ts b/types/cli-cursor/cli-cursor-tests.ts new file mode 100644 index 0000000000..877ce32f94 --- /dev/null +++ b/types/cli-cursor/cli-cursor-tests.ts @@ -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); diff --git a/types/cli-cursor/index.d.ts b/types/cli-cursor/index.d.ts new file mode 100644 index 0000000000..d6decf8479 --- /dev/null +++ b/types/cli-cursor/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for cli-cursor 2.1 +// Project: https://github.com/sindresorhus/cli-cursor#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * 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; diff --git a/types/cli-cursor/tsconfig.json b/types/cli-cursor/tsconfig.json new file mode 100644 index 0000000000..2d57093f55 --- /dev/null +++ b/types/cli-cursor/tsconfig.json @@ -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" + ] +} diff --git a/types/cli-cursor/tslint.json b/types/cli-cursor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cli-cursor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }