is there a way to return a class from a function? ...
# getting-started
b
is there a way to return a class from a function? Looking at
Copy code
fun buildApp(): JsClass<Any> {
    class X
    return X
}
but it complains about not having a companion object; when I add one though, it complains about local classes not being able to have a companion object. I need it to be a local since I need to populate some static fields
1
s
Maybe you want
return X::class
Though I'm not sure if references to local classes are allowed either 🤔
b
I'll probably write a small js wrapper around it and type it in Kotlin
::class fixes the return error, still not being able to set any statics though
s
Okay, I think I understand what you're trying to do. I'm not sure if it's possible, though. JS and Kotlin deal with classes and statics in different ways, so the overlap is inexact. Maybe someone in the #javascript channel will be better able to help.
b
👍