Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
type myEventHandler<T extends myEvent> = (event: T) => void;

I am new to typescript.

Wondering what exactly this line means in TS?:

type myEventHandler<T extends myEvent> = (event: T) => void;

I know that <> is a type assertion. So I guess myEventHandler should be the type of T. But the 'myEventHandler' is also a type, right? So is that mean we can define a type that belongs to another type?? I guess the event:T is a parameter, so a type can also have a parameter? This line looks like a fat arrow function... and it has a void. Can someone explain it?

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

In this case <T extends myEvent> is not a type assertion. It rather declares the type as generic. You can now pass arguments of any type T, as long as the type extends myEvent.

You should read the TypeScript introduction to Generics for further reference.

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda