Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

449
Views
Angular: el carrusel Swiper no funciona - Error: node_modules/swiper/angular/angular/src/swiper-events.d.ts

Estoy tratando de crear un carrusel en angular usando swiper ( https://swiperjs.com/angular ).

me sale este error:

Error: node_modules/swiper/angular/angular/src/swiper-events.d.ts:3:50 - error TS2344: el tipo 'SwiperEvents[Property]' no satisface la restricción '(...args: any) => ningún'. Escriba '((swiper: Swiper) => void) | ((swiper: Swiper) => vacío) | ((swiper: Swiper) => vacío) | ((swiper: Swiper) => vacío) | ((swiper: Swiper) => vacío) | ((swiper: Swiper) => vacío) | ... 75 más ... | undefined' no se puede asignar al tipo '(...args: any) => any'. El tipo 'indefinido' no se puede asignar al tipo '(...args: any) => any'.

He intentado esto:

-Desinstalar e instalar nuevamente swiper con npm i swiper

-Desinstalar swiper e instalarlo nuevamente con npm i @types/swiper

Aquí está mi código:

angular.json

 "styles": [ "src/myTheme.scss", "src/styles.css", "node_modules/swiper/swiper-bundle.min.css" ], "scripts": ["node_modules/swiper/swiper-bundle.min.js"] },

El módulo compartido

 import { SwiperModule } from 'swiper/angular'; exports: [ SwiperModule, other modules ]

el componente:

 config: SwiperOptions = { slidesPerView: 3, spaceBetween: 50, navigation: true, pagination: { clickable: true }, scrollbar: { draggable: true }, }; //in the methods onSwiper([swiper]) { console.log(swiper); } onSlideChange() { console.log('slide change'); }

el HTLM

 <swiper [config]="config" (swiper)="onSwiper($event)" (slideChange)="onSlideChange()" > <ng-template swiperSlide>Slide 1</ng-template> <ng-template swiperSlide>Slide 2</ng-template> <ng-template swiperSlide>Slide 3</ng-template> <ng-template swiperSlide>Slide 4</ng-template> <ng-template swiperSlide>Slide 5</ng-template> <ng-template swiperSlide>Slide 6</ng-template> </swiper>

sb tiene una idea de lo que esta pasando?? Gracias

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Tuve exactamente el mismo problema. La instalación de v7 resolvió el problema.

 npm i swiper@7
about 4 years ago · Juan Pablo Isaza Report

0

La instalación de swiper@7 funciona. Pero para Angular 13, podría aparecer un error como este.

 Error: node_modules/swiper/angular/angular/src/public-api.d.ts:1:15 - error TS2307: Cannot find module './swiper-events' or its corresponding type declarations. 1 export * from './swiper-events';

Pero esto se puede resolver ejecutando una simple npm update .

about 4 years ago · Juan Pablo Isaza Report

0

Para corregir este error, instale: https://www.npmjs.com/package/ngx-swiper-wrapper

e instale una versión específica npm i swiper@6.4.15 y se resolvió.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!