Skip to content

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

@sparecycles

Description

@sparecycles

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions