Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support generic parameter default type #1003

Open
FlorianCassayre opened this issue Aug 17, 2023 · 2 comments
Open

Support generic parameter default type #1003

FlorianCassayre opened this issue Aug 17, 2023 · 2 comments

Comments

@FlorianCassayre
Copy link

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")
@FlorianCassayre
Copy link
Author

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

@olegshtch
Copy link
Contributor

I did PR to support bounds but it wasn't accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants