How does one validate typescript models at runtime? I have seen combinations of JSON schema and validator libraries but I'd love to do it using typescript's type system. From my understanding, it doesn't work because of type erasure.
AFAIK there's no good solution. That's why it works best when your back end is using Typescript as well -- your route returns the same interface the client is expecting.
This goes out the window when you have multiple deployed/running versions of your client or server.
Would one solve this by versioning the types somehow? Honest question; I'm pretty new to TS.