Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions types/node/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5381,8 +5381,8 @@ declare module "stream" {
highWaterMark?: number;
decodeStrings?: boolean;
objectMode?: boolean;
write?: (chunk: string | Buffer, encoding: string, callback: Function) => any;
writev?: (chunks: Array<{ chunk: string | Buffer, encoding: string }>, callback: Function) => any;
write?: (chunk: any, encoding: string, callback: Function) => any;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really any here or should this be something like {} to avoid null and undefined?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote "any" to match the definition of write on the stream. The documentation also says <any>; I know of no reason it couldn't be null or undefined on an object-mode stream.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have read here https://nodejs.org/dist/latest/docs/api/stream.html#stream_writable_write_chunk_encoding_callback that null is not allowed in object mode. But you are right the APIs should be symmetric.

writev?: (chunks: Array<{ chunk: any, encoding: string }>, callback: Function) => any;
destroy?: (error?: Error) => any;
final?: (callback: (error?: Error) => void) => void;
}
Expand Down
4 changes: 2 additions & 2 deletions types/node/v4/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2365,8 +2365,8 @@ declare module "stream" {
highWaterMark?: number;
decodeStrings?: boolean;
objectMode?: boolean;
write?: (chunk: string | Buffer, encoding: string, callback: Function) => any;
writev?: (chunks: { chunk: string | Buffer, encoding: string }[], callback: Function) => any;
write?: (chunk: any, encoding: string, callback: Function) => any;
writev?: (chunks: { chunk: any, encoding: string }[], callback: Function) => any;
}

export class Writable extends Stream implements NodeJS.WritableStream {
Expand Down
4 changes: 2 additions & 2 deletions types/node/v6/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3710,8 +3710,8 @@ declare module "stream" {
highWaterMark?: number;
decodeStrings?: boolean;
objectMode?: boolean;
write?: (chunk: string | Buffer, encoding: string, callback: Function) => any;
writev?: (chunks: { chunk: string | Buffer, encoding: string }[], callback: Function) => any;
write?: (chunk: any, encoding: string, callback: Function) => any;
writev?: (chunks: { chunk: any, encoding: string }[], callback: Function) => any;
}

export class Writable extends Stream implements NodeJS.WritableStream {
Expand Down
4 changes: 2 additions & 2 deletions types/node/v7/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3818,8 +3818,8 @@ declare module "stream" {
highWaterMark?: number;
decodeStrings?: boolean;
objectMode?: boolean;
write?: (chunk: string | Buffer, encoding: string, callback: Function) => any;
writev?: (chunks: { chunk: string | Buffer, encoding: string }[], callback: Function) => any;
write?: (chunk: any, encoding: string, callback: Function) => any;
writev?: (chunks: { chunk: any, encoding: string }[], callback: Function) => any;
}

export class Writable extends Stream implements NodeJS.WritableStream {
Expand Down
4 changes: 2 additions & 2 deletions types/node/v8/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5367,8 +5367,8 @@ declare module "stream" {
highWaterMark?: number;
decodeStrings?: boolean;
objectMode?: boolean;
write?: (chunk: string | Buffer, encoding: string, callback: Function) => any;
writev?: (chunks: Array<{ chunk: string | Buffer, encoding: string }>, callback: Function) => any;
write?: (chunk: any, encoding: string, callback: Function) => any;
writev?: (chunks: Array<{ chunk: any, encoding: string }>, callback: Function) => any;
destroy?: (error?: Error) => any;
final?: (callback: (error?: Error) => void) => void;
}
Expand Down