jsr icon indicating copy to clipboard operation
jsr copied to clipboard

error[unsupported-nested-javascript]: referenced a JavaScript module without type declarations from a TypeScript module

Open alexgleason opened this issue 1 year ago • 1 comments

There's a problem with types in the @noble/hashes (github, npm) module in my package.json

When I run npx jsr publish I get the following error:

➜  nostr-tools git:(master) ✗ npx jsr publish --dry-run
Checking for slow types in the public API...
error[unsupported-nested-javascript]: referenced a JavaScript module without type declarations from a TypeScript module
 --> /home/alex/Projects/nostr-tools/node_modules/.deno/@[email protected]/node_modules/@noble/hashes/utils.d.ts
  = hint: add a type declaration (d.ts) for the JavaScript module, or rewrite it to TypeScript

  info: JavaScript files with no corresponding declaration require type inference to be type checked
  info: fast check avoids type inference, so referencing a JavaScript file with no type declarations is not supported
  docs: https://jsr.io/go/slow-type-unsupported-nested-javascript

This package contains errors for slow types. Fixing these errors will:

  1. Significantly improve your package users' type checking performance.
  4. Improve the automatic documentation generation.
  5. Enable automatic .d.ts generation for Node.js.

Don't want to bother? You can choose to skip this step by
providing the --allow-slow-types flag.

error: Found 1 problem
Child process exited with: 1

Things I tried:

  1. having "type": "module" in package.json
  2. having "moduleResolution": "Bundler" in tsconfig.json

The upstream package has types:

image

This issue does not occur when using deno publish, only npx jsr

alexgleason avatar Mar 11 '24 20:03 alexgleason

@alexgleason What problem is failing to publish? noble-hashes or nostr-tools?

lucacasonato avatar Apr 02 '24 10:04 lucacasonato

Closing as I didn't get a response from DM. I think this was fixed already.

lucacasonato avatar Nov 08 '24 13:11 lucacasonato