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

Could not find a declaration file for module '@solid-codemirror/codemirror'. #9

Open
sparecycles opened this issue Jun 4, 2024 · 0 comments

Comments

@sparecycles
Copy link

Types are broken with current typescript (5.4.5), at least for my tsconfig anyway.

image

The error continues with

There are types at '.../@solid-codemirror/codemirror/dist/index/index.d.ts',
but this result could not be resolved when respecting package.json "exports".
The '@solid-codemirror/codemirror' library may need to update its
package.json or typings.

ts(7016)

The fix is to add "types" to packages.json "exports".
(Both in core and codemirror modules).

e.g.,

{
  "name": "@solid-codemirror/codemirror",
  "version": "1.0.4",
  "type": "module",
  "main": "dist/index/index.common.js",
  "module": "dist/index/index.module.js",
  "types": "dist/index/index.d.ts",
  "exports": {
    ".": {
      "solid": "./dist/index/CodeMirror.jsx",
      "import": "./dist/index/index.module.js",
      "types": "./dist/index/index.d.ts",  /* <-- fix */
      "browser": {
        "import": "./dist/index/index.module.js",
        "require": "./dist/index/index.common.js"
      },
      "require": "./dist/index/index.common.js",
      "node": "./dist/index/index.common.js"
    }
  },
  ...

Unfortunately npx patch-package does not, for... reasons, update package.json files, so this fix has to be made upstream.

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

1 participant