frhagn / Typewriter

Automatic TypeScript template generation from C# source files
http://frhagn.github.io/Typewriter
Apache License 2.0
536 stars 132 forks source link

Support for generic type constraints? #321

Open RudeySH opened 5 years ago

RudeySH commented 5 years ago

I'm using TypeWriter to convert all my C# models into TypeScript interfaces. One of my models looks like this:

public class ListData<TOptions> where TOptions : ListOptions { ... }

In this context ListOptions is another model that will also be converted into a TypeScript interface. However, the generated TypeScript interface of my ListData model looks like this:

interface ListData<TOptions> { ... }

The generic type constraint is lost. I want to achieve the following:

interface ListData<TOptions extends ListOptions> { ... }

I was hoping the TypeParameterCollection would contain information about the constraint, so I could achieve the above. However, I was not able to find any reference to generic type constraints. Are they not supported?