Couldn't find any, is there a YouTrack issue for K...
# javascript
e
Couldn't find any, is there a YouTrack issue for K/JS to get an annotation similar to
@JvmStatic
?
👍 1
a
I don't think that there is any
gratitude thank you 1
a
No, unfortunately
e
@Artem Kobzar thanks! Do you think it would be a valid feature request? Example I've got on hands right now:
Copy code
public class Properties private constructor(private val data: Map<String, String>) {
  public companion object {
    @JvmStatic
    fun decode(string: String): Properties {
       ...
    }
  }
}
Will output the following
d.ts
:
Copy code
class Properties {
    private constructor();
    static get Companion(): {
        decode(string: string): Properties;
    };
}
I can see two problems from a JS/TS consumer point of view: 1. What's a "companion"? 2. Why can't I simply
Properties.decode(...)
To workaround the companion issue I'm now using
Copy code
@JsName("factory")
public companion object Factory {
So it will look good in all platforms, and a JS/TS consumer can use:
Copy code
Properties.factory().decode(...)
a
I was thinking about it and I think it's a valid feature request for sure
gratitude thank you 1
e
Well apparently there was an issue, see https://youtrack.jetbrains.com/issue/KT-18891
The comments seems to be asking for a similar implementation