-
Notifications
You must be signed in to change notification settings - Fork 158
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
Iterable interface cannot be extended #731
Comments
It seems that the jsweet/transpiler/src/main/java/org/jsweet/transpiler/Java2TypeScriptTranslator.java Line 1722 in ac8ef70
I don't understand why this is designed in this way. Can someone explain? If the interface extension is erased, shouldn't its methods be inlined? |
Standard JSweet behavior (without j4ts) is to remove java references and replace it with a JS implementation. Since Iterable is not a JS type, it won't appear at runtime. What you see in the code you linked above is a call to an adapter, which allows to switch behavior when necessary, for instance if you need to keep some type in a specific project. By default, the Is it a problem that this super interface gets erased in TypeScript? I honestly doubt this is related to this issue? |
I believe the error comes from the TypeScript compiler:
If you look at the generated TypeScript, you can see that the problem is a TS source issue with the missing I'll take a look at |
Yes, methods are supposed to be inlined indeed. This sounds like a bug. You will find somewhere in the translator some code to handle inlining of default methods specifically. |
This is a regression, as it was working in 2.3.7.
I suspect the default methods in Iterable are the issue, but it is just a guess.
Paste this code into the live sandbox to demonstrate the spurious compile error:
The text was updated successfully, but these errors were encountered: