From a2502b4487d4182cee2a371fbc09ecb7a11851d9 Mon Sep 17 00:00:00 2001 From: Tim JK Date: Wed, 28 Oct 2015 17:16:40 +1300 Subject: [PATCH] Add definitions for isaacs node read --- read/read-tests.ts | 18 ++++++++++++++++++ read/read.d.ts | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 read/read-tests.ts create mode 100644 read/read.d.ts diff --git a/read/read-tests.ts b/read/read-tests.ts new file mode 100644 index 000000000..54d270813 --- /dev/null +++ b/read/read-tests.ts @@ -0,0 +1,18 @@ +/// + +import read = require('read'); + +var opts: read.Options; +opts = { + prompt: 'please enter...', + silent: true, + replace: '*', + timeout: 1500, + default: 'nothing', + edit: false, + terminal: true, + input: {x: 'thing'}, + output: {y: 'thang'} +}; + +read(opts, function (error, result, isDefault) { }); diff --git a/read/read.d.ts b/read/read.d.ts new file mode 100644 index 000000000..9ab7f15d4 --- /dev/null +++ b/read/read.d.ts @@ -0,0 +1,24 @@ +// Type definitions for read +// Project: https://github.com/isaacs/read +// Definitions by: Tim JK +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'read' { + function Read(options: Read.Options, callback: (error: any, result: string, isDefault: boolean) => any): void; + + module Read { + interface Options { + prompt?: string; + silent?: boolean; + replace?: string; + timeout?: number; + default?: string; + edit?: boolean; + terminal?: boolean; + input?: any; + output?: any; + } + } + + export = Read; +}