From 37c0cec6d477c06f7cad3993ec06a9615b8b9d20 Mon Sep 17 00:00:00 2001 From: Andrew Gaspar Date: Thu, 15 Aug 2013 21:41:33 -0500 Subject: [PATCH 1/3] Added tests for through --- through/through-tests.ts | 9 +++++++++ through/through.d.ts | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 through/through-tests.ts create mode 100644 through/through.d.ts diff --git a/through/through-tests.ts b/through/through-tests.ts new file mode 100644 index 000000000..93fc6d2fa --- /dev/null +++ b/through/through-tests.ts @@ -0,0 +1,9 @@ +import through = require('through'); + +var i = 0; +through( + function () { + this.queue((i++).toString()); + }, function () { + this.queue(null); + }, { autoDestroy: true }).pipe(process.stdout); \ No newline at end of file diff --git a/through/through.d.ts b/through/through.d.ts new file mode 100644 index 000000000..969d003d9 --- /dev/null +++ b/through/through.d.ts @@ -0,0 +1,21 @@ +/// + + + +declare module "through" { + import Stream = require("stream"); + + function through(write: (data) => void, + end?: () => void, + opts?: { + autoDestroy: boolean; + }): through.ThroughStream; + + module through { + export interface ThroughStream extends Stream.ReadWriteStream { + autoDestroy: boolean; + } + } + + export = through; +} \ No newline at end of file From ec27374e4185d3686bf20ff4db77483c22515d63 Mon Sep 17 00:00:00 2001 From: Andrew Gaspar Date: Thu, 15 Aug 2013 21:45:15 -0500 Subject: [PATCH 2/3] Added header comments for through --- through/through.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/through/through.d.ts b/through/through.d.ts index 969d003d9..d348c5d18 100644 --- a/through/through.d.ts +++ b/through/through.d.ts @@ -1,7 +1,10 @@ +// Type definitions for through +// Project: https://github.com/dominictarr/through +// Definitions by: Andrew Gaspar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + /// - - declare module "through" { import Stream = require("stream"); From b1ae0480301cd1ad699e9bddd93229cb2eb71e7f Mon Sep 17 00:00:00 2001 From: Andrew Gaspar Date: Thu, 15 Aug 2013 23:13:11 -0500 Subject: [PATCH 3/3] Made all arguments optional --- through/through.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/through/through.d.ts b/through/through.d.ts index d348c5d18..7d2adce5e 100644 --- a/through/through.d.ts +++ b/through/through.d.ts @@ -8,7 +8,7 @@ declare module "through" { import Stream = require("stream"); - function through(write: (data) => void, + function through(write?: (data) => void, end?: () => void, opts?: { autoDestroy: boolean;