ta-json icon indicating copy to clipboard operation
ta-json copied to clipboard

TypeScript Constructors are erased unless explicitly called - parsing fails

Open jonasandero opened this issue 4 years ago • 0 comments

I have successfully used your framework to build a service but i am facing an issue. I have an entity class that I do not instanceiate any where in the code - it is only created by calls to TaJson.parse(). While can understand why tsc erases the constructor function - since it is not explicitly called - I wonder if there is a clever way to prevent it from being erased? The only ways i can come up with is to either create a dummy instance somewhere or to export a function that calls the constructor. Both feels a bit "hackish".

Ideas?

jonasandero avatar Apr 01 '20 21:04 jonasandero