How to include IReturn<T>

When I just want a few types to be generated in my dtos.ts, I have problems with IReturn.
It seems that it is ignored in the IncludeTypes. Result is that the code fails; I always add manually

export interface IReturn<T>
{
    createResponse(): T;
}

after generation. Any tips?

so I have:

IncludeTypes: IReturn<T>,IReturnVoid,,IGet,IPost,MyApiResponse,MyApi

and generated at first

export interface IReturnVoid
{
    createResponse(): void;
}

For generic Types use the .NET Type Name, i.e. backtick followed by number of generic args:

IncludeTypes=IReturn`1

Wow that did the trick.
Might be a small documentation update worth for other dummies like myself? (or is it already there?)

That’s .NET’s Type Name for generic type definitions e.g: typeof(IReturn<>).Name.

I don’'t want to pollute each language with the same docs, so I’ve only included a note in C# / TypeScript pages as they’re the most popular.

1 Like