Angular 与@types/swiper
Angular with @types/swiper
我在 Angular 6 项目中使用 @types/swiper
时出现错误(无法将 'new' 用于类型缺少调用或构造签名的表达式)尝试创建一个新的 Swiper 实例。
@types/swiper
中 swiper
模块的声明是错误的:声明说该模块具有 Swiper
[=17= 的命名导出 Swiper
],但它实际上具有 class 的默认导出(或导出分配,具体取决于您的捆绑器是使用 CommonJS 还是 ES6 版本:argh,愚蠢的包装)。我已经提交了 a pull request to DefinitelyTyped to attempt to fix the declaration. If you use my modified declaration (see 的可能方法),您的代码应该可以成功编译。
我在 Angular 6 项目中使用 @types/swiper
时出现错误(无法将 'new' 用于类型缺少调用或构造签名的表达式)尝试创建一个新的 Swiper 实例。
@types/swiper
中 swiper
模块的声明是错误的:声明说该模块具有 Swiper
[=17= 的命名导出 Swiper
],但它实际上具有 class 的默认导出(或导出分配,具体取决于您的捆绑器是使用 CommonJS 还是 ES6 版本:argh,愚蠢的包装)。我已经提交了 a pull request to DefinitelyTyped to attempt to fix the declaration. If you use my modified declaration (see