Kafka-node: `ProducerStream` not compatible with @types/node@^14.0.0

Created on 2 Jun 2020  路  1Comment  路  Source: SOHU-Co/kafka-node

in @types/node, the typescript signature of Writable._write(...) function changed from
_write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void;
to
_write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;

This is not compatible with kafka-node definition of ProducerStream

../../node_modules/kafka-node/types/index.d.ts:143:3 - error TS2416: Property '_write' in type 'ProducerStream' is not assignable to the same property in base type 'Writable'.
  Type '(message: ProduceRequest, encoding: "utf8" | "buffer", cb: (error: any, data: any) => any) => void' is not assignable to type '(chunk: any, encoding: BufferEncoding, callback: (error?: Error) => void) => void'.
    Types of parameters 'encoding' and 'encoding' are incompatible.
      Type 'BufferEncoding' is not assignable to type '"utf8" | "buffer"'.
        Type '"ascii"' is not assignable to type '"utf8" | "buffer"'.

143   _write (message: ProduceRequest, encoding: 'buffer' | 'utf8', cb: (error: any, data: any) => any): void;
      ~~~~~~

Most helpful comment

I have the same problem after upgrading to kafka-node^5.0.0.

Update:

Add "skipLibCheck": true to tsconfig.json works for me.

>All comments

I have the same problem after upgrading to kafka-node^5.0.0.

Update:

Add "skipLibCheck": true to tsconfig.json works for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghinks picture ghinks  路  6Comments

kameshwari-suresh picture kameshwari-suresh  路  3Comments

quorak picture quorak  路  5Comments

AnnisaNurika picture AnnisaNurika  路  5Comments

aamitsharma2705 picture aamitsharma2705  路  4Comments