:wave: I'm trying to decide when it's preferable t...
# javascript
j
👋 I'm trying to decide when it's preferable to use an
external interface
vs a regular
interface
- does anyone have any thoughts on this?
h
external interface
is for "external" plain JS code only, eg a 3rd plain JS library, you want to use in Kotlin/JS.
j
gotcha, but if I wanted to share an interface with my non-js code and a react component, I could safely use a regular interface for that?
h
Which way? If you want to use the Kotlin/JS component in plain JS, you need
@JSExport
. Otherwise you can use
external interface
(or even better use typescript) and consume it in Kotlin/JS.
j
Hmmm I want my interfaces in -common to be used as part of the props on a react component in -js, e.g.: common:
Copy code
interface Dog { 
  abstract val name: String
}
js:
Copy code
interface RenderDogsListProps : RProps {
    val dogs: Set<Dog>
}
So I think what I'm understanding here is I'll need to mark
Dog
with
@JSExport
?