Subscribe - It's FREE!!

Stay Connected Here

Stay Updated With Us Here



Google

Typewriter - Automatic TypeScript Template generation from C# classes in Visual Studio


Share with WhatsApp



This post is to introduce "Typewriter", extension for visual studio that generates TypeScript files from C# code files using TypeScript templates.

Using this awesome extension you can create fully typed TypeScript representations of server side API, models, controllers etc. By installing this extension you get TypeScript Intellisense and compile-time errors when the client- and server side code differs. This speeds up your development pace and increases the quality of your applications.

Just to give an practical intro, below is the example from the Typewriter site.

Suppose, If you add a CustomerModel class like below.

using System;
using System.Collections.Generic;

namespace Demo
{
    public class CustomerModel
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public ICollection<OrderModel> Orders { get; set; }
    }
}

then CustomerModel.ts file gets created automatically like below

module App {
    export class CustomerModel {
        public id: number;
        public name: string;
        public orders: OrderModel[];
    }
}

Isn't this amazing and time saving?

For this you just need to define the template like below .tst file (this file gets used by typewriter to generate the TypeScript code.)

module App { $Classes(*Model)[
    export class $Name { $Properties[
        public $name: $Type;]
    }]
}

Checkout many more other features here.

Do share your opinion in the comment section and don't forget to share this information with your friends using share buttons provided below.



If you enjoyed this post take 5 seconds to share it! Be Socialable. :-)

Share with WhatsApp

Posts To Read Next

Swagger - Powerful Opensource Framework for RESTful API

With a Swagger-enabled API, you get interactive documentation, client SDK generation and discoverability. Swagger Editor allows you to generate code, documentation with ease.


Assembla - Free and private repository to manage your source code online with SVN subversion hosting

With Assembla you can share source code with others online. Free & Private source code repository with SVN Subversion, Git & Perforce Hosting.


Top 10 Visual Studio things which can boost developers coding speed

Visual Studio 2012 provides some coding features by which you can code faster if use them properly. This post will cover top 10 things among them to boost your development speed.


Visual Studio Code - Lighweight but powerful source code editor available for Windows, OS X and Linux

Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, OS X and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (C++, C#, Python, PHP) and runtimes.


How to call click or any event only once in jQuery

Know how to execute an click event or any event only once for any element in jQuery. Perform action only once and even not required to unbind event.


Your opinion is valuable for us! Comments, suggetions are welcome.


Submit your Email Id to stay updated with us and get notified with our new posts. It's FREE!
Vu 32'' TV Vu 24'' TV
We know this popup is disturbing you!
But We would greatly appreciate if you share us with your friends below!

It will not take more than 2 seconds but will motivate us greatly to write more,share more!

x