deezer / KustomExport

EXPERIMENTAL : A JS facade generator for KotlinJS / KMP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enum : Use the given String parameter to fill the value

glureau opened this issue · comments

Currently we can define an enum like that

enum class Foo(val value: String) {
  ONE("one"), TWO("hey")
}

But once wrapped, there is no way to get the parameters. We don't want to support all super-powers of Kotlin enums right now. Using the given parameter if there is only one string, and returning the value in the facade could be enough.

23c0198

I actually provided all properties of the enum to the JS facade, as it's easier for now (waiting to see how Kotlin 1.6.20 handle enum exports).

'name' and 'ordinal' are Kotlin enum keywords and cannot be override, also KustomExport override "name" to put the entry name (as a string, so minification should be fine). 'ordinal' is not provided in the facade, I don't think using ordinal make a lot of sense, but please comment if you have a use case!