DTO to TypeScript generator
Check out the open-source project NSwag: With the GUI, you can select a .NET class from an existing assembly and generate the TypeScript interface for it.
There is also a command line tool and support for T4 templates as well as generation of client code for Web API controllers...
There is a new library called TypeScriptD which will create .d.ts
files for your .NET classes.
This can be run as a command and works for .NET or winmd.
There are lots of projects that do this. Your best bet today will be to assess which option is still actively maintained, and meets your requirements ð¹
- TypeLITE : http://type.litesolutions.net/
- TypeScriptModelsGenerator : https://www.nuget.org/packages/TypeScriptModelsGenerator
- NSwag : https://github.com/RicoSuter/NSwag
- ToTypeScriptD : https://github.com/ToTypeScriptD/ToTypeScriptD
- TypeScripter : http://cjlpowers.github.io/TypeScripter/
- MTT : https://github.com/CodySchrank/MTT
- TypeGen : https://github.com/jburzynski/TypeGen
Note
The world is strongly going TypeScript for both front and backend. Hence the diverse state of cross language tooling.
I had a similar need but found the existing projects were too limiting in one way or another (buggy, no generics, no methods, etc.) so I ended up rolling my own (http://cjlpowers.github.io/TypeScripter/). In my case I was dealing with ServiceContract/DataContract types on the server and needed .d.ts files to aid client side development. The solution is extensible should you need to tweak it.