0

我在我的项目中使用 editorjs,并且我的项目中没有打字稿文件。找不到模块“@editorjs/image”的声明文件。'node_modules/@editorjs/image/dist/bundle.js' 隐含了一个 'any' 类型。尝试npm i --save-dev @types/editorjs__image它是否存在或添加包含declare module '@editorjs/image';ts(7016) 的新声明 (.d.ts) 文件 没有可用的快速修复。typescript 包不可用,当我在项目中创建 .d.ts 文件时, declare module "@editorjs/image" 它并没有引用 editorjs/image 包的用法。

4

1 回答 1

0

问题是.d.ts您在项目中创建的文件也应该在您的项目中列为您的项目的一部分tsconfig.json

  "include": [
    "**/*.ts",
    "**/*.tsx",
    "global.d.ts" // << specify your file here
  ],
于 2022-02-08T01:49:44.990 回答