solid-codemirror icon indicating copy to clipboard operation
solid-codemirror copied to clipboard

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

Open sparecycles opened this issue 8 months ago • 0 comments

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.

sparecycles avatar Jun 04 '24 23:06 sparecycles