[@types/minipass]: error TS2416: Property ‘end’ in type ‘MiniPass’ is not assignable to the same property in base type ‘WritableStream’

Discussed in #57970

Originally posted by akornatskyy January 4, 2022
Reproducable with @types/node 17.0.6+.

node_modules/@types/minipass/index.d.ts(30,5): error TS2416: Property 'end' in type 'MiniPass' is not assignable to the same property in base type 'WritableStream'.
Type '{ (cb?: () => void): void; (chunk: any, cb?: () => void): void; (chunk: any, encoding?: string, cb?: () => void): void; }' is not assignable to type '{ (cb?: () => void): this; (data: string | Uint8Array, cb?: () => void): this; (str: string, encoding?: BufferEncoding, cb?: () => void): this; }'.
Type 'void' is not assignable to type 'this'.
'this' could be instantiated with an arbitrary type which could be unrelated to 'void'.
```</div>

1 thought on “[@types/minipass]: error TS2416: Property ‘end’ in type ‘MiniPass’ is not assignable to the same property in base type ‘WritableStream’

  1. It’s not the exact same message but I’ve got the same kind of errors when compiling with MongoDB 4.2.2 with @types/node:17.0.7:

    node_modules/mongodb/mongodb.d.ts:3314:5 - error TS2416: Property 'end' in type 'GridFSBucketWriteStream' is not assignable to the same property in base type 'Writable'.
      Type '{ (): void; (chunk: Buffer): void; (callback: Callback<void | GridFSFile>): void; (chunk: Buffer, callback: Callback<void | GridFSFile>): void; (chunk: Buffer, encoding: BufferEncoding): void; (chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<...>): void; }' is not assignable to type '{ (cb?: (() => void) | undefined): this; (chunk: any, cb?: (() => void) | undefined): this; (chunk: any, encoding: BufferEncoding, cb?: (() => void) | undefined): this; }'.
    
    3314     end(chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<GridFSFile | void>): void;
             ~~~
    
    node_modules/mongodb/mongodb.d.ts:3314:5 - error TS2416: Property 'end' in type 'GridFSBucketWriteStream' is not assignable to the same property in base type 'WritableStream'.
      Type '{ (): void; (chunk: Buffer): void; (callback: Callback<void | GridFSFile>): void; (chunk: Buffer, callback: Callback<void | GridFSFile>): void; (chunk: Buffer, encoding: BufferEncoding): void; (chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<...>): void; }' is not assignable to type '{ (cb?: (() => void) | undefined): this; (data: string | Uint8Array, cb?: (() => void) | undefined): this; (str: string, encoding?: BufferEncoding | undefined, cb?: (() => void) | undefined): this; }'.
    
    3314     end(chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<GridFSFile | void>): void;
    

    It’s not failiing when using @types/node:17.0.5.

    Any hint?

Comments are closed.