wangEditor icon indicating copy to clipboard operation
wangEditor copied to clipboard

使用typescript 没有识别到index.d.ts文件

Open wython opened this issue 8 months ago • 1 comments

bug 描述

ide 其中的一个描述如下:

 “d:/work/farbay-frontend/apps/admin-cicle/node_modules/@wangeditor/editor-for-vue/dist/src/index.d.ts”处有类型,但在遵守 package.json "exports" 时无法解析此结果

完整描述如下:

Image

通过ai提示,尝试修改node_modules文件下,相关的packages.josn文件 添加如下代码得以解决问题:

// node_modules/@wangeditor/editor-for-vue/package.json
{
  "types": "./dist/src/index.d.ts",
  "exports": {
    ".": {
      "types": "./dist/src/index.d.ts", // 添加这一行
      "import": "./dist/index.esm.js",
      "require": "./dist/index.js"
    }
  }
}

所以提出问题是否是由于package.json导出问题导致该问题

系统和浏览器及版本号

  • 操作系统 window
  • 浏览器和版本

wangEditor 版本

"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",

demo 能否复现该 bug ?

不能

wython avatar May 13 '25 17:05 wython

也可以切换 wangeditor-next 原来的包没有导出 types https://github.com/wangeditor-team/wangEditor-for-vue3/issues/23

cycleccc avatar May 15 '25 01:05 cycleccc