How about compiling C# Interfaces to TS interfaces?

Topics: General
Oct 2, 2012 at 3:44 PM


Typescript looks great, so thanks a lot for sharing :)!

One area where I can see it will be handy is handling complex objects passed from the server side to the client via json. On the server side I already have C# interfaces describing these objects, because I need the interfaces to write unit tests.

On the client side, it would be very handy to be able to compile Typescript interfaces from those C# interfaces so I could regenerate them automatically with each compiler run.

I know this is not possible yet, but I just wanted to make this suggestion in case it might be handy for other ASP.NET / MVC developers.



Oct 2, 2012 at 6:50 PM

At Microsoft we're also hard at work on the Roslyn project, which is out in CTP and which offers a public high fidelity API over C# and VB source code. Based on Roslyn, anyone should be able to go build a converter from C# interfaces to TypeScript interfaces. I imagine that would be a very popular tool!


Oct 2, 2012 at 8:30 PM

well, if you have interface (in proper architecture always a separate assembly) you can using reflection and little coding write converter in no time.

Nov 14, 2012 at 3:34 PM


This would be very useful in MVC scenarios when posting JSON that gets converted into C# POCOs on the server.

This would be great to add to the Web Essentials project.


Dec 13, 2012 at 6:37 PM
Edited Dec 13, 2012 at 6:38 PM

I hacked together a C# to TypeScript interface generator over here: