Skip to content

Commit

Permalink
loosen Readable and Writable types
Browse files Browse the repository at this point in the history
This was causing some errors when attempting to pipe to stdout, and
other writable streams in node that have an fd member.
  • Loading branch information
isaacs committed May 15, 2023
1 parent c2aa0b2 commit 4eb8c16
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,24 @@ import { Stream } from 'stream'
export namespace Minipass {
export type Encoding = BufferEncoding | 'buffer' | null

export interface Writable extends EventEmitter {
end(): any
write(chunk: any, ...args: any[]): any
}

export interface Readable extends EventEmitter {
pause(): any
resume(): any
pipe(): any
}
export type Writable =
| Minipass<any, any, any>
| NodeJS.WriteStream
| (NodeJS.WriteStream & { fd: number })
| (EventEmitter & {
end(): any
write(chunk: any, ...args: any[]): any
})

export type Readable =
| Minipass<any, any, any>
| NodeJS.ReadStream
| (NodeJS.ReadStream & { fd: number })
| (EventEmitter & {
pause(): any
resume(): any
pipe(...destArgs: any[]): any
})

export type DualIterable<T> = Iterable<T> & AsyncIterable<T>

Expand Down

0 comments on commit 4eb8c16

Please sign in to comment.