Type 'Promise<Readable>' is not assignable to type 'Readable | Buffer'

31 views Asked by At

I am having this error while trying to run npm build

nodes/Gpg/Gpg.node.ts:141:8 - error TS2322: Type 'Promise<Readable>' is not assignable to type 'Readable | Buffer'.
  Type 'Promise<Readable>' is missing the following properties from type 'Buffer': write, toJSON, equals, compare, and 96 more.

141        pgpData = this.helpers.getBinaryStream(binaryData.id);
           ~~~~~~~

nodes/Gpg/Gpg.node.ts:199:8 - error TS2322: Type 'Promise<Readable>' is not assignable to type 'Readable | Buffer'.

199        pgpData = this.helpers.getBinaryStream(binaryData.id);

my code is as follows

let pgpData : Readable | Buffer;
if (binaryData.id) {
    pgpData = this.helpers.getBinaryStream(binaryData.id);
} else {
    pgpData = Buffer.from(binaryData.data, BINARY_ENCODING);
}

Is there anywhere I'm doing wrong?

0

There are 0 answers