Typelite POCO Class Generation

This feature is supported by Reinforced.Typings.

Using attribute

[TsClass]
public class Person
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
}

or fluent call

public class Configuration
{
    public static void Configure(ConfigurationBuilder builder) 
    {
            builder
                .ExportAsClass<Person>()
                .WithPublicProperties();
    }
}

will produce following to the output file:

namespace MyApp {
    export class User
    {
        public FirstName: string;
        public LastName : string;
    }
}

Unfortunately this scenario isn't supported right now.

I have never missed such feature, because classes usually have some methods, so it didn't make a sense to me. But feel free to fiddle with the source ('TsGenerator.cs'), it shouldn't be too difficult to generate classes instead of interfaces if you don't require any methods in the classes.


What I did was make a simple adjustment to the tt file, saves you from compiling your own typelite:

<#= definitions.ToString()
.Replace("interface", "export class")
.Replace("declare module", "module") #>