Closed chfeiler closed 6 years ago
Hello again, it seems like the type mapping and especially erased classes/interfaces are not only ignored at 'import' statements but also in this for loop in 'visitClassDef' in 'Java2TypeScriptTranslator' which automatically creates abstract method signatures in abstract classes for methods which are inherited from interfaces. These interfaces might however been erased by an adapter or directly by an annotation; in that case the signatures shouldn't be created. If this issue with the type mappings and '@Erased' annotations is not a design choice on purpose I can work on a fix for this issue!
It's a bug indeed. Well done :) Feel free to PR, I will review and merge
Fixed with #492.
Hello!
It seems like JSweet transpiler imports classes/types even though they were mapped to a different type. This behaviour can be observed when instructing the transpiler to use modules. Example: we add a type mapping in our custom PrinterAdapter:
And still the import pops up in the transpiled type script file:
It not only happens with mapped types, but also with
@Erased
classes. The expected behaviour would be that the transpiler does not import mapped types or erased classes. I guess the problem is caused by this for loop in visitTopLevel in the Java2TypeScriptTranslator: it callsuseModule
without checking whether the import is needed. Can you confirm this guess?