I'm working with an API that returns an object containing a list of various concrete types that share a common base. Is there a way to automate the process of mapping these items to a specific Typescript interface model-type without having to manually map each one?
Is it possible to leverage the "$type" property that JSON.NET includes in the JSON object and automatically map it to a Typescript interface/model instance? Or is there another method that doesn't involve manual mapping?
Note: In my case, the .NET class namespace is removed during serialization from the API for client requests (e.g. { $type: 'Foo' }
instead of { $type: 'MyApp.Models.Foo' }
)