typescript-generator icon indicating copy to clipboard operation
typescript-generator copied to clipboard

Fix support for nullability in Kotlin interfaces and abstract classes

Open mwalser opened this issue 2 years ago • 1 comments

When encountering a Kotlin property the type parser attempts to find the backing java field: https://github.com/vojtechhabarta/typescript-generator/blob/7a33aa0d8b4ce9e0a7d6626e65195b4c995b2871/typescript-generator-core/src/main/java/cz/habarta/typescript/generator/parser/TypeParser.java#L193

However, in interfaces and abstract classes a property might not have a Java field. In this case the parser falls back to the Java type parser which doesn't know about Kotlin nullability: https://github.com/vojtechhabarta/typescript-generator/blob/7a33aa0d8b4ce9e0a7d6626e65195b4c995b2871/typescript-generator-core/src/main/java/cz/habarta/typescript/generator/parser/TypeParser.java#L200

This PR fixes #708 by changing the behavior to directly use the return type of the Kotlin property.

mwalser avatar Apr 24 '22 18:04 mwalser

Any idea when this will get merged?

johnellinwood avatar Sep 13 '22 21:09 johnellinwood

Hello, Our team are waiting for this fix as well.

yuuzer avatar Oct 14 '22 08:10 yuuzer

Our team is also waiting for this fix, would be cool to merge it.

wojtre avatar Nov 07 '22 09:11 wojtre

@vojtechhabarta Is there anything I can do to support this PR getting merged?

If you have any suggestions about changes I have to make to get this in a mergeable state I would gladly invest some time.

mwalser avatar Nov 14 '22 10:11 mwalser

@mwalser, @hho thank you for this PR.

vojtechhabarta avatar Nov 17 '22 17:11 vojtechhabarta