I am trying out Kotlin/JS.
As an exercice to learn something new I wanted to mess with WebRTC. I've been following the basic examples on their site and at some point you have to instantiate an object from the RTCPeerConnection
class. Something very straight forward and available without installing any dependencies.
If I come on the browser's console I can easily do:
However in my IntelliJ the compiler screams at me stating that there is no such class so I can't instantiate it.
Now I know of two ways I could get around to this:
- Using
fun js(code: String): dynamic
, which works but I lose all intelli-sense and type-safety making me really sad (and kind of missing the point of using Kotlin) - Declaring (using
external
keyword) the entirety of the RTC spec which is very extense and that also makes me really sad
I've found out a way to hack my way around the second approach but still is not good enough:
I've installed @types/webrtc
from NPM in this fashion:
implementation(npm("@types/webrtc", "0.0.30", generateExternals=true))
So I could trick Dukat to generate the external declarations for me and I've actually succeeded!
… or that's what I thought
Has somebody worked this out of it?