Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

370
Visualizações
enfrentando algún problema para establecer el tipo en sweetalert2

Typescript me dio 2 errores en la variable toastMixin y en el objeto de animación. No encontré ninguna solución para solucionarlo.

Error:

 let toastMixin: typeof Swal No overload matches this call. Overload 1 of 2, '(options: SweetAlertOptions<any, any>): Promise<SweetAlertResult<any>>', gave the following error. Argument of type '{ animation: boolean; title: string; }' is not assignable to parameter of type 'SweetAlertOptions<any, any>'. Object literal may only specify known properties, and 'animation' does not exist in type 'SweetAlertOptions<any, any>'. Overload 2 of 2, '(title?: string | undefined, html?: string | undefined, icon?: SweetAlertIcon | undefined): Promise<SweetAlertResult<any>>', gave the following error. Argument of type '{ animation: boolean; title: string; }' is not assignable to parameter of type 'string'.ts(2769)

Código: TS que muestra el error en let toastMixin y en el objeto de animation

 export const errorHandle = (massage:string) => { let toastMixin = Swal.mixin({ toast: true, icon: 'success', title: 'General Title', animation: false, position: 'top-right', showConfirmButton: false, timer: 3000, timerProgressBar: true, didOpen: (toast) => { toast.addEventListener('mouseenter', Swal.stopTimer) toast.addEventListener('mouseleave', Swal.resumeTimer) } }); if (massage === 'added') { toastMixin.fire({ animation: true, title: 'Successfully added' }); } else if (massage === 'duplicate') { toastMixin.fire({ title: 'You already added the developer', icon: 'error' }); } else if (massage === 'removed') { toastMixin.fire({ animation: true, title: 'Removed' }); } }
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Porque no debería haber un campo de animation en el parámetro que pasa a Swal, como se muestra aquí https://github.com/sweetalert2/sweetalert2/blob/master/sweetalert2.d.ts#L442

about 4 years ago · Juan Pablo Isaza Relatório

0

Se eliminó el parámetro de animation , use showClass y hideClass en su lugar:

 Swal.fire({ icon: 'success', title: 'I am not animated', showClass: { backdrop: 'swal2-noanimation', // disable backdrop animation popup: '', // disable popup animation icon: '' // disable icon animation }, hideClass: { popup: '', // disable popup fade-out animation }, })
 <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda