JamesBroadberry / deno-bcrypt

A port of jBCrypt to TypeScript for use as a Deno module
ISC License
67 stars 5 forks source link

Argument of type 'string' is not assignable to parameter of type 'number | undefined' #1

Closed alirealasad closed 4 years ago

alirealasad commented 4 years ago

hi, I was trying this library but I am getting this error. how can I solve this?

error: TS2345 [ERROR]: Argument of type 'string' is not assignable to parameter of type 'number | undefined'. const hash = await bcrypt.hash("test", salt);

import * as bcrypt from "https://deno.land/x/bcrypt/mod.ts";

const salt = await bcrypt.genSalt(8);
const hash = await bcrypt.hash("test", salt);

console.log(hash);
JamesBroadberry commented 4 years ago

It looks like there's a bug with the types used in new async methods introduced. For now, you can leave the salt undefined and it'll be auto-generated which is recommended anyway.

I'll get the fix out soon and you can then either specify the new version when importing it or use --reload when running your script to continue using the latest.

Thanks for raising the issue 👍

JamesBroadberry commented 4 years ago

I've implemented this fix - please use the --reload flag when running and feel free to re-open this if you're still having problems!