Skip to content
forked from jburzynski/TypeGen

Single-class-per-file C# to TypeScript generator

License

Notifications You must be signed in to change notification settings

sdamian/TypeGen

 
 

Repository files navigation

TypeGen

Single-class-per-file C# to TypeScript generator

Build status

Please visit project's website: http://jburzynski.net/TypeGen

How to get

Quick start

Get TypeGen via NuGet by either:

  • typing Install-Package TypeGen into the Package Manager Console
  • searching TypeGen in the NuGet gallery / NuGet package manager

Mark your C# classes/enums as exportable to TypeScript:

using TypeGen.Core.TypeAnnotations;

[ExportTsClass]
public class ProductDto
{
    public decimal Price { get; set; }
    public string[] Tags { get; set; }
}

After building your project, type into the Package Manager Console:

TypeGen ProjectFolder

...where ProjectFolder is your project folder, relative to your solution directory.

This will generate a single TypeScript file (named product-dto.ts) in your project directory. The file will look like this:

export class ProductDto {
    price: number;
    tags: string[];
}

Features

Some of TypeGen's features include:

  • generating TypeScript classes, interfaces and enums - single class per file
  • support for collection (or nested collection) property types
  • generic classes/types generation
  • support for inheritance
  • customizable convertion between C#/TypeScript names (naming conventions)

For complete list of features with examples, please refer to the project's documentation: http://typegen.readthedocs.io

About

Single-class-per-file C# to TypeScript generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 95.0%
  • TypeScript 3.5%
  • Other 1.5%