Since typescript uses structural typing, what how ...
# javascript
b
Since typescript uses structural typing, what how do you ensure that only instances of a sealed interface are passed in? add a __superMyLibInternalIgnore property? Main use case is converting a ton of typed Event objects (e.g. OrderEvent, SignUpEvent) into data classes that can be passed to Ktor Client. It almost looks like I'd need to serialize those objects into JSON and then deserialize them onto data classes, but ofc that would throw at runtime as well
1
b
Thanks for bringing this up! Currently, we don't verify this, and this is a bug. I've created an issue: KT-88015. Feel free to upvote.
As a workaround, you can introduce a `@JsExport.Ignore`d member into the interface, which will force the generation of the
__doNotUseOrImplementIt
property in the interface:
Copy code
@JsExport
sealed interface I {
  @JsExport.Ignore
  fun __workaround() {}
}
b
thank you
I suppose there's some symbol workaround as well that's more robust