Skip to content

example using generics in type mappings #366

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

Closed
zhuker opened this issue Jun 6, 2019 · 2 comments
Closed

example using generics in type mappings #366

zhuker opened this issue Jun 6, 2019 · 2 comments

Comments

@zhuker
Copy link

zhuker commented Jun 6, 2019

i want to map
class ListWrapper<T> to typescript T[]
how do i do it?

Finally I returned to this issue and it is now possible to use generics in customTypeMappings parameter.
Released in v2.10.466.

Originally posted by @vojtechhabarta in #197 (comment)

@vojtechhabarta
Copy link
Owner

I thing you can map ListWrapper<T> Java class to Array<T> TypeScript type (which is the same as T[]).
Maven configuration example:

<customTypeMappings>
    <mapping>com.package.ListWrapper:Array</mapping>
</customTypeMappings>

This should work since both ListWrapper and Array have exactly one generic parameter.

@vojtechhabarta
Copy link
Owner

Please note that in 2.16.538 release I changed customTypeMappings parameter format (#384) so it is now needed to specify generic classes including their generic parameters:

<customTypeMappings>
    <mapping>com.package.ListWrapper[T]:Array[T]</mapping>
</customTypeMappings>

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