How are Kotlin classes and interfaces represented ...
# javascript
d
How are Kotlin classes and interfaces represented in JS? More specifically, if I wanted to create a multiplatform library, can I easily export interfaces or abstract classes to be implemented/extended in JS? I'm considering starting a project, and I can't easily find this documented
b
To represent classes we use “standard” JS’s prototypal inheritance and in the future we going to switch to ES6 classes. So you can use Kotlin’s classes as usual JS’s classes.
In JS we don’t have interfaces, so Kotlin compiler generates something like abstract classes and mix them when they are inherited. So, you can do same thing, but I’d suggest to avoid do it 🙂.
👍 1
d
Thanks!