TypeGen allows you to specify which C# classes should be converted to TypeScript using two different methods:
Method 1: Using Attributes
Decorate your C# classes with the [ExportTsClass] attribute.
Method 2: Using a Generation Spec
Create a class that inherits from GenerationSpec and use the AddClass<T>() method to register types. This is useful if you want to manage exports in a centralized file rather than decorating every class.
// Method 1: Using attributes
[ExportTsClass]
public class ProductDto
{
public decimal Price { get; set; }
public string[] Tags { get; set; }
}
// Method 2: Using a specification file
public class MyGenerationSpec : GenerationSpec
{
public MyGenerationSpec()
{
AddClass<ProductDto>();
}
}