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

305
Views
TS2345: el argumento genérico de tipo no se puede asignar al parámetro de tipo en TypeScript 4.4

Desde que actualicé Typescript versión 4.0 a 4.4 , recibo algunos errores con Generics y no puedo solucionarlos.

 const isFirstData = <TFirst, TSecond>( item: { type: ItemType.FIRST; data: TFirst } | { type: ItemType.SECOND; data: TSecond } ): item is { type: ItemType.FIRST; data: TFirst } => item.type === ItemType.FIRST; const rows: ({ type: ItemType.SECOND; data: TSecond; } | { type: ItemType.FIRST; data: TFirst; })[]; const item = rows[0]; const height = isFirstData(item) ? First?.value : Second?.value; // Argument of type '{ type: ItemType.SECOND; data: TData; } | { type: ItemType.FIRST; data: TFirst; }' is not assignable to parameter of type '{ type: ItemType.FIRST; data: TData; } | { type: ItemType.SECOND; data: TData; }'.

¿Alguien puede explicar qué ha cambiado en mecanografiado y cómo solucionar mi error?

about 4 years ago · Juan Pablo Isaza
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!