Skip to content

Add "types" to the package's "exports"#2

Open
divergentdave wants to merge 1 commit into
fission-codes:mainfrom
divergentdave:exports-types
Open

Add "types" to the package's "exports"#2
divergentdave wants to merge 1 commit into
fission-codes:mainfrom
divergentdave:exports-types

Conversation

@divergentdave

Copy link
Copy Markdown

When importing this package using a newer version of TypeScript, with the settings "module": "nodenext", "moduleResolution": "nodenext", TypeScript was not able to find the declarations file, because it was only checking the exports.

error TS7016: Could not find a declaration file for module 'one-webcrypto'. '.../node_modules/one-webcrypto/node.mjs' implicitly has an 'any' type.
There are types at '.../node_modules/one-webcrypto/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'one-webcrypto' library may need to update its package.json or typings.

This PR adds the declaration file to the package's exports, while keeping the "types" key for both older versions of TypeScript, and for the TS badge on NPM.

(FWIW, I was also able to work around this by adding the following to tsconfig.json, but this may be fragile: "paths": {"one-webcrypto": "./node_modules/one-webcrypto/index.d.ts"})

@jczstudios

Copy link
Copy Markdown

@fission-codes Can this be merged soon? Am also experiencing this using "module": "bundler".

gobengo added a commit to storacha/one-webcrypto that referenced this pull request Oct 24, 2023
same motivation fission-codes#2

Signed-off-by: Benjamin Goering <171782+gobengo@users.noreply.github.com>
@alanshaw

Copy link
Copy Markdown

We forked it here https://github.com/storacha/one-webcrypto

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

Successfully merging this pull request may close these issues.

3 participants