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

137
Vistas
How did the kind property get removed from (type SquareEvent & type CircleEvent)

how did the kind property get removed from SquareEvent & CircleEvent

type EventConfig<Events extends { kind: string }> = { 
  [E in Events as E["kind"]]: (event: E) => void; 
}
type SquareEvent = { kind: "square", x: number, y: number };
type CircleEvent = { kind: "circle", radius: number };
type Config = EventConfig<SquareEvent | CircleEvent> 

//  type Config = {
  square: (event: SquareEvent) => void; 
  circle: (event: CircleEvent) => void; 
} 

btw u can Find this Example code in the Typescript Handbook page 131

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can find it in Typescript Handbook, right after the snippet you posted:

// Remove the 'kind' property
type RemoveKindField<Type> = {
    [Property in keyof Type as Exclude<Property, "kind">]: Type[Property]
};
 
interface Circle {
    kind: "circle";
    radius: number;
}
 
type KindlessCircle = RemoveKindField<Circle>;
           
type KindlessCircle = {
    radius: number;
}

https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#key-remapping-via-as

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