Any ideas how i can declare `expect` of the folowi...
# multiplatform
b
Any ideas how i can declare
expect
of the folowing JS class in common module so I could
typealias
it in JS module?
Copy code
class ExternalAPI {
  val important: dynamic
}
For context, I'm working on pushing KotlinJS browser API down to common module and implememnting it for WASM as well. To keep compatability with kotlinJS (and also some boilerplate code) I'd like to typealias all that to
org.w3c.*
packages on JS.
k
I'm assuming that ExternalApi is a class you jave created and that dynamic is the Js dependency You can make a expect class NAME_HEREin common then use actual typealias NAME_HERE = dynamic. Then in common expect class ExternalApi { val important : NAME_HERE } I also think interfaces can be used in place of expect/ actual
b
That doesn't work. I get
Type alias expands to dynamic, which is not a class, an interface, or an object
having
Copy code
expect class Dynamic

actual typealias Dynamic = dynamic
k
What is dynamic?
b
dynamic is KotlinJS keyword