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

135
Views
¿Cómo se eliminó la propiedad kind de (escriba SquareEvent y escriba CircleEvent)?

¿Cómo se eliminó la propiedad amable de SquareEvent y 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; }

Por cierto, puede encontrar este código de ejemplo en la página 131 del Manual de TypeScript

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede encontrarlo en el Manual de TypeScript, justo después del fragmento que publicó:

 // 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 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!