diff --git a/types/csv-stringify/csv-stringify-tests.ts b/types/csv-stringify/csv-stringify-tests.ts index f899896a5d..e73e9abde3 100644 --- a/types/csv-stringify/csv-stringify-tests.ts +++ b/types/csv-stringify/csv-stringify-tests.ts @@ -25,6 +25,9 @@ stringify([["1", true, new Date()], ["4", false, new Date()]], { stream = stringify({ delimiter: "," }); stream.write(["1", "2", "3"]); +stream.write(["4", true, new Date()], 'utf8', (err: Error, output: string): void => { + // nothing +}); const transform: NodeJS.ReadWriteStream = stream; diff --git a/types/csv-stringify/index.d.ts b/types/csv-stringify/index.d.ts index e727a0dcd9..78c049ad3a 100644 --- a/types/csv-stringify/index.d.ts +++ b/types/csv-stringify/index.d.ts @@ -69,12 +69,11 @@ declare namespace stringify { } interface Stringifier extends NodeJS.ReadWriteStream { - // Stringifier stream takes array of strings or Object - write(line: string[] | any): boolean; + // Stringifier stream takes array of strings or Object, and optional encoding and callback + write(line: string[] | any, encoding?: string, cb?: (error: Error | undefined, output: string) => void): boolean; // repeat declarations from NodeJS.WritableStream to avoid compile error - write(buffer: string | Buffer, cb?: () => void): boolean; - write(str: string, encoding?: string, cb?: () => void): boolean; + write(buffer: string | Buffer, cb?: (error: Error | undefined, output: string) => void): boolean; } }