Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
105
rated 0 times [  109] [ 4]  / answers: 1 / hits: 84855  / 12 Years ago, thu, october 18, 2012, 12:00:00

I am just going to start use TypeScript in my HTML client project which belongs to a MVC project with a entity framework domain model already there. I want my two projects (client side and server side) totally separated as two teams will work on this... JSON and REST is used to communicate objects back and forth.



Of course, my domain objects on the client side should match the objects on the server side. In the past, I have normally done this manually. Is there a way to reuse my C# class definitions (specially of the POJO classes in my domain model) to create the corresponding classes in TypeScript?


More From » typescript

 Answers
230

There is not currently anything that will map C# to TypeScript. If you have a lot of POCOs or you think they might change often, you could create a converter - something simple along the lines of...


public class MyPoco {
public string Name { get; set; }
}

To


export class MyPoco {
public Name: string;
}

There is also a discussion on Codeplex about auto-generating from C#.


Just to keep things updated, TypeLite can generate TypeScript interfaces from C#:


http://type.litesolutions.net/


[#82492] Tuesday, October 16, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tylerdamiena

Total Points: 139
Total Questions: 90
Total Answers: 118

Location: Liechtenstein
Member since Wed, Dec 8, 2021
2 Years ago
tylerdamiena questions
;