of the folowing JS class in common module so I could
typealias
it in JS module?
Copy code
class ExternalAPI {
val important: dynamic
}
Big Chungus
03/22/2020, 5:44 PM
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
Kweku
03/23/2020, 3:52 PM
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
Big Chungus
03/23/2020, 3:55 PM
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