【发布时间】:2018-12-11 13:16:51
【问题描述】:
我正在尝试构建 CKEditor5 的自定义版本。
按照the official document 中提到的步骤,我得到了ckeditor.js。我希望生成一个打字稿文件(ckeditor.ts 或 ckeditor.d.ts),以便我可以在 Angular 项目中使用它。
【问题讨论】:
标签: angular typescript webpack typescript-typings ckeditor5
我正在尝试构建 CKEditor5 的自定义版本。
按照the official document 中提到的步骤,我得到了ckeditor.js。我希望生成一个打字稿文件(ckeditor.ts 或 ckeditor.d.ts),以便我可以在 Angular 项目中使用它。
【问题讨论】:
标签: angular typescript webpack typescript-typings ckeditor5
您也可以在 TS 项目中使用 JS 文件。您只需要在tsconfig.json 文件中设置allowJs: true。如果您将严格模式设置为 true,那么您可能需要为您的构建添加一个简单的声明文件 - https://github.com/ckeditor/ckeditor5-angular/blob/master/src/typings.d.ts。
实际上有一张关于生成声明文件的待处理票 - https://github.com/ckeditor/ckeditor5/issues/504。 CKEditor 5 构建的非常简单的声明文件如下所示:https://github.com/ckeditor/ckeditor5-angular/blob/46799e389bae907613774a893166646425d36de1/src/ckeditor/ckeditor.ts#L8
【讨论】: