Can typescript compiler create POCO.NET types / assembly?

I am developing applications using knockout with MVC and EF, and I am watching how adding TypeScript to the recipe can help me.

I like the cleanup mechanism for development in the IDE, but the missing thing seems to be the ability to refer to interfaces defined in TypeScript from other .NET collections.

Am I right that nothing prevents this from happening otherwise than it was done? I am curious if there is a demand for it or if I consider the problem area in such a way that others are not.

The reason I see the utility is because I currently have no way to define this DTO in only one place. I must either authorize them separately in my C # View model, or in javascript / typescript, or I need to use something like a knockout display plugin that is too "magical" for my tastes.

Note I do not ask to convert .NET TypeScript. I just like TypeScript interfaces for creating usable .NET POCO types.

Note2 : I just found http://typescript.codeplex.com/ which does what I ask in the opposite direction (from .NET to typescript), and this may be enough for the problem that I am expressing in this question.

+4
source share
5 answers

There is a utility for converting C # classes to Typescript: http://type.litesolutions.net/

That way you can have your DTOs in one place, i.e. C #. Available on Nuget and is open source on BitBucket, so feel free to modify (even generate code) and contribute.

+3
source

See my answer on: Breeze.js typed objects

You cannot use my solution in knockout patterns, but it definitely helps on the TypeScript side.

+1
source

I approached this issue by serializing JSON and vice versa. Depending on your needs, the simplicity of it is worth it, and if your document is complex, it is necessary.

0
source

Starting with version 1.7, Bridge supports the generation of TypeScript type definitions in C #. In this article, you will learn how to instruct the Bridge compiler to release .d.ts along with the corresponding .js files and use them in a Visual Studio TypeScript project

http://bridge.net/docs/generate-typescript-definitions/

0
source

Typewriter is a free extension for Visual Studio that generates TypeScript files from C # code files using TypeScript Templates.This allows you to create fully typed TypeScript server representations APIs, models, controllers, SignalR hubs, etc. that automatically update when you are making changes to your c # code. TypeScript Intellisense errors and compilation times when client and server code is different. This speeds up the pace of development and improves the quality of your applications.

https://frhagn.imtqy.com/Typewriter/

0
source

All Articles