I'm using @types/swiper in Angular 6 project and I'm getting an error (Cannot use 'new' with an expression whose type lacks a call or construct signature) when trying to create a new instance of Swiper.
StackBlitz
The declaration of the swiper module in @types/swiper is wrong: the declaration says that the module has a named export Swiper of the Swiper class, but it actually has a default export of the class (or an export assignment depending on whether your bundler uses the CommonJS or the ES6 version: argh, stupid packaging). I've submitted a pull request to DefinitelyTyped to attempt to fix the declaration. If you use my modified declaration (see this answer for the possible ways to do that), your code should compile successfully.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With