A type-safe cast in TypeScript with a discrminiating union (like C++'s dynamic_cast)

后端 未结 0 1772
醉梦人生
醉梦人生 2020-12-22 01:39

I\'m looking for a readable way to do a type-safe cast in TypeScript. I have an object with a discriminating union, and I have an unclear syntax for casting.

         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题