node-crc icon indicating copy to clipboard operation
node-crc copied to clipboard

Fix typings

Open amishshah opened this issue 4 years ago • 0 comments

Hi there! Firstly, thank you for making this library, I'm finding it very useful!

I'm using this library with TypeScript, and it's a bit cumbersome when dealing with the return type of the crc functions:

import { crc } from 'node-crc';

const result = crc(...someArguments);

if (!result) {
  throw new Error('failure');
}
// here, result is of type `true | Buffer` instead of just Buffer,
// since the return type is given as `boolean | Buffer`

I've updated the typings to use the more correct return types of false | Buffer instead of boolean | Buffer.

amishshah avatar Mar 24 '21 22:03 amishshah