<@U02BK8ABTQF> have you considered converting a `f...
# javascript
e
@Artem Kobzar have you considered converting a
fun interface
to an arrow function? Given this example:
Copy code
@JsExport
public fun interface ExampleFun {
  public fun doSomething(str: String)
}

@JsExport
public interface ExampleUsage {
  public fun example(fn: ExampleFun)
}
I can see the resulting TS declaration is:
Copy code
export declare interface ExampleFun {
    doSomething(str: string): void;
    readonly __doNotUseOrImplementIt: {
        readonly "com.hcl.mainframe.zproto.ExampleFun": unique symbol;
    };
}
export declare interface ExampleUsage {
    example(fn: ExampleFun): void;
    readonly __doNotUseOrImplementIt: {
        readonly "com.hcl.mainframe.zproto.ExampleUsage": unique symbol;
    };
}
However it would be more meaningful to translate it to an arrow function. It also allows better interoperability between Kotlin and Java, being that in Java a fun interface can be used as lambda.
t
However it would be more meaningful to translate it to an arrow function.
What if I have 2 fun interfaces and implement both in my class? How it will work? 🙂
e
@turansky trying to visualize what you mean but I'm failing, could you post a very short example?
t
Copy code
fun interface A {
    fun doA(): AAA
}

fun interface B {
    fun doB(): BBB
}

class C: A, B {
   // implementation
}
e
So by that you mean that with a method like
Copy code
public interface ExampleUsage {
  public fun example(fn: A)
}
after transforming to an arrow function the code wouldn't work anymore. Yeah that's true
What about limiting the use of
fun interface
for hierarchies in KotlinJS? Or maybe an additional
Js*
annotation
a
We could discuss it inside the team. Could I ask you to create a ticket in YouTrack with your arguments, why should it be a function type instead of the interface?
e
@Artem Kobzar sure. I'm going to discuss the POC multiplatform project internally tomorrow and I'll prepare a list of all the issues or usability problems I've found, so I'll open all the necessary tickets.
👍 1