Does it possible to use Javascript decorators in Kotlin?


Javascript has decorators, which widely uses in react examples (at last in our company).

Does it possible to use this decorators in Kotlin? Or how to insert decorator (as plain javascript code) from Kotlin?


AFAIK there is not pretty way of using decorators in Kotlin/JS at the moment.

To run arbitrary code you could do the following:

val unused = run {
    println("Arbitrary Kotlin code")
    js("console.log('arbitrary JS code')")


Yes, I know about this possibility, but it’s impossible to insert javascript pure code on the top of the class (like decorators looks)


It’s not supported yet. Feel free to vote or star the issue (KT-18894) to get updates.