gpt4 book ai didi

angular - 错误 : Could not find a declaration file for module '@ckeditor/ckeditor5-build-classic' angular 9

转载 作者:行者123 更新时间:2023-12-03 16:56:45 26 4
gpt4 key购买 nike

我想在 angular 9 中使用 ckeditor,我按照 https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/angular.html 中的说明进行操作
但它在我导入“@ckeditor/ckeditor5-build-classic”时显示错误:

Could not find a declaration file for module '@ckeditor/ckeditor5-build-classic'. 

'a:/repositories/BasimStore/source/Web/Frontend/node_modules/@ckeditor/ckeditor5-build-classic/build/ckeditor.js' implicitly has an 'any' type.
Try `npm install @types/ckeditor__ckeditor5-build-classic` if it exists or add a new declaration (.d.ts) file containing `declare module '@ckeditor/ckeditor5-build-classic';`
enter image description here
我在 package.json 中有 "@ckeditor/ckeditor5-angular": "^1.2.3"和 "@ckeditor/ckeditor5-build-classic": "^20.0.0"但它仍然显示错误。
我在 ckeditor5-build-classic 文件夹中找不到 index.d.ts。我应该如何解决这个错误?

最佳答案

添加 打字.d.ts 项目根目录或任何文件夹中的文件
将以下代码添加到打字文件中

declare module '@ckeditor/ckeditor5-build-classic' {
const ClassicEditorBuild: any;

export = ClassicEditorBuild;
}
就是这样,angular 将自动检测类型并将其编译为依赖项,这将解决官方 CKEDITOR 页面中也提出的问题: https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/angular.html
enter image description here
目录结构
enter image description here

关于angular - 错误 : Could not find a declaration file for module '@ckeditor/ckeditor5-build-classic' angular 9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62690188/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com