External overloaded operators

In Axios an instance can be created, and other than calling methods you can invoke it directly.
Naturally I would add something like “operator fun invoke(config: AxiosConfigSettings): AxiosPromise” to my external interface AxiosInstance.

However, at runtime I get “Uncaught TypeError: $module$axios.invoke is not a function”.

How can this be accomplished?

operator fun AxiosInstance.invoke(config: AxiosConfigSettings): AxiosPromise

Or am I missing something?

Writing it like that a body is required and interfaces don’t allow that.

For now I have to assume that operator overloading doesn’t work for externals in kotlin/js.

interface A
class B : A
operator fun A.invoke() {
fun main() {
   val b = B()

This works…
Or is external not from outside the interface?

I’m sorry, but I don’t think you know what I mean by external: https://kotlinlang.org/docs/reference/js-interop.html

Also, I don’t want to make my own invoke function. I want to be able to call the invoke function on the object in javascript. That is why I’m defining an external.

So in the javascript module Axios you have an object called axios. You can call methods on it like axios.get() and axios.post(). But you can also use it as a function axios(). I want to call THAT function.

The natural solution would be to define an invoke operator like I would for get and post. But as I said that doesn’t work when I in runtime get “Uncaught TypeError: $module$axios.invoke is not a functio”.
Remember when you define external methods you are not implementing it. You are only telling the kotlin compiler what is in the javascript module.