Are there plans to return external enums in the fu...
# javascript
a
Are there plans to return external enums in the future? This looks ugly:
Copy code
sealed external class DropEffects {
    @JsName("copy")
    object Copy : DropEffects

    @JsName("move")
    object Move : DropEffects

    @JsName("link")
    object Link : DropEffects

    @JsName("none")
    object None : DropEffects
}
t
In most cases such unions are open in fact
As result - const enums (new feature) will solve only half of problem
a
Idea suggests to use data objects. But obviously, you can't do that for external subclasses.
t
In described example
objects
aren't required,
val
is fine
a
You mean simple constants?
t
Yes, like here
Copy code
sealed external interface Align {
    companion object {
        val TOP: Align
        val LEFT: Align
        val BOTTOM: Align
        val RIGHT: Align
    }
}
a
I see
t
We use objects only in case, when separate types are really required
One more example of constant
Which bonuses do you expect from enums in your case? Short declaration only?
a
yes
t
DropEffects
in your example - string union emulation?
a
Yes. In this particular case, I think string constants will do. But it is an import from TS.