jsSHA: Error when i create jsSHA object
I have react application. I have implemented jsSHA library installed using npm. When I initiate the object getting Uncaught TypeError: jsSHA is not a constructor. Below my code
const hash_obj_mobile_number = new jsSHA("SHA-256", "TEXT", { encoding: "UTF8" }), hash_obj_consent_pin = new jsSHA("SHA-256", "TEXT", { encoding: "UTF8" }); hash_obj_mobile_number.update(mobile_number); hash_obj_consent_pin.update(login_pin); const hash_mobile_number = hash_obj_mobile_number.getHash("HEX"); const hash_consent_pin = hash_obj_consent_pin.getHash("HEX");
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 24 (13 by maintainers)
@joadr: Try adding
"esModuleInterop": trueinto yourtsconfig.jsonif it’s not already in there (see my tsconfig.json for an example). I remember some funniness with TypeScript and default imports which I believe was fixed with that config.