Open GarouDan opened 8 years ago
Thank you for reporting this issue. It has to do with how JSweet and TypeScript work, so it is not really a JSweet bug (at least it is shared responsibilities).
At runtime, the Window
class, which is part of the JavaScript DOM, is not actually in the jsweet.dom
package. This package is here for Java naming and referencing purpose at compile time, but it is erased by JSweet and don't exist at runtime (note also that def.libname
packages in candies have no runtime existence).
Additionally, in TypeScript, there is no easy way to reference a global element when it is hidden by a local element (see this complicated TypeScript issue: https://github.com/Microsoft/TypeScript/issues/983).
We could do a fix, indeed (I see how), but it would be quite complicated for what it would bring. So far I will not assign it for any milestone because it is not a crucial issue, but I will keep it in mind for later.
When we try to extend the jsweet.dom.Window like this
we got this error:
Description Resource Path Location Type Cycle detected: the type Window cannot extend/implement itself or one of its own member types Window.java .../controller line 5 Java Problem
But this code works:
So we can't use the same name. But this is strange since we are on a different packages. I saw the jsweet.dom.Window code and maybe this happens because it has another properties with the type Window. But I think we should be able to extend as in the first example.
Is this a bug?