My two cents on how `@JsExports` should work in th...
# javascript
a
My two cents on how
@JsExports
should work in the near future Let
@JsExport
export every thing to global namespace. Example in a module
sea
file:
sea/src/main/kotlin/com/sea/entities.kt
Copy code
package com.sea

@JsExport
class Fish(val type: String = "Tilapia")

@JsExport
class Whale(val name: String = "Deep Blue")
and to be use in typescript as
Copy code
import { Whale, Fish } from 'sea'

const whale = new Whale("Killer Whale");
const tilapia = new Fish();
However, since sometimes scoping is needed. We can pass parameters to the
@JsExport
like so
Copy code
package com.sea

@JsExport
class Fish(val type: String = "Tilapia")

@JsExport("mammals")
class Whale(val name: String = "Deep Blue")
and to be use in typescript as
Copy code
import { mammals, Fish } from 'sea'

const whale = new mammals.Whale("Killer Whale");
const tilapia = new Fish();
I know this is hard right now (due to how the Compiler build js), but the very desired sytax from the above case is
Copy code
import { Fish } from 'sea'

import { Whale } from 'sea/mammals'

const whale = new Whale("Killer Whale");
const tilapia = new Fish();
I hope this one gets some love Issue is already on YT at https://youtrack.jetbrains.com/issue/KT-37710 please give more votes
t
Votes really required 🙂
😀 1