vojtechhabarta / typescript-generator

Generates TypeScript from Java - JSON declarations, REST service client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support generic parameter default type

FlorianCassayre opened this issue · comments

We are designing some custom extensions for our project, and one them relies on the generic parameter default type feature of Typescript. For example:

interface Test<T = string> {}

The current API of typescript-generator regarding generics is the following:

public static class GenericVariableType extends BasicType {
    public GenericVariableType(String name) {
        super(name);
    }
}

As you can see it is not possible to provide a default type, therefore we would like to request this functionality in the API.

Luckily the following workaround works (although it looks dirty):

new TsType.GenericVariableType("T = string")

I think a similar comment can be made about type bounds, I am not sure if these are supported either.