Typescript build error
faljse opened this issue · comments
Martin Kunz commented
- jsSHA version: 3.3.0
- JavaScript engine and version: node18/chrome
tsc compiler complains on import:
Code
import jsSHA from "jssha";
Could not find a declaration file for module 'jssha'.
'c:/Users/sydfg/projects/xxx/node_modules/jssha/dist/sha.mjs' implicitly has an 'any' type.
There are types at 'c:/Users/sydfg/projects/xxx/node_modules/jssha/dist/sha.d.ts',
but this result could not be resolved when respecting package.json "exports".
The 'jssha' library may need to update its package.json or typings.ts(7016)
Martin Kunz commented
adding "types" to packages.json like this fixes the issue for me.
"exports": {
".": {
"types": "./dist/sha.d.ts",
"import": "./dist/sha.mjs",
"require": "./dist/sha.js"
},
...
Brian Turek commented
The amount of churn in the Javascript/Typescript ecosystem is staggering :(
I just added extra exports for all the types. I'll push v3.3.1 as it appears this is a widespread issue.