Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript build error #103

Closed
faljse opened this issue Aug 4, 2023 · 2 comments
Closed

Typescript build error #103

faljse opened this issue Aug 4, 2023 · 2 comments

Comments

@faljse
Copy link

faljse commented Aug 4, 2023

  • 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)
@faljse
Copy link
Author

faljse commented Aug 4, 2023

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"
    },
...

@Caligatio
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants