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

146
Views
El argumento de tipo 'AnimationEvent_2' no se puede asignar al parámetro de tipo 'AnimationEvent'

Estoy tratando de hacer una devolución de llamada de animación en angular, y obtuve un error de tipo que se puede suprimir fácilmente con type any . Quiero entender por qué AnimationEvent no es aceptado por mecanografiado.

Mi componente:

 import { Component } from '@angular/core'; import { animate, state, style, transition, trigger } from "@angular/animations"; @Component({ selector: 'app-animation-callback', animations: [ trigger('openClose', [ state('open', style({ height: '200px', })), state('closed', style({ height: '100px', })), transition('open <=> closed', [ animate('.1s') ]), ]), ], template: ` <nav> <button (click)="toggle()">Toggle</button> </nav> <div [@openClose]="isOpen ? 'open' : 'closed'" (@openClose.start)="onAnimationEvent($event)" (@openClose.done)="onAnimationEvent($event)" class="open-close-container"> Text </div> `, }) export class AnimationCallbackComponent { isOpen = true; toggle() { this.isOpen = !this.isOpen; } onAnimationEvent(event: AnimationEvent) { } }

El error durante la compilación:

 error TS2345: Argument of type 'AnimationEvent_2' is not assignable to parameter of type 'AnimationEvent'. (@openClose.done)="onAnimationEvent($event)" ~~~~~~
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Intente agregar importación en su componente:

 import { AnimationEvent } from "@angular/animations";

Sin importar, se usa el AnimationEvent nativo de TypeScript, que es un tipo completamente diferente.

over 4 years ago · Santiago Trujillo 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!