kotlinx.serialization icon indicating copy to clipboard operation
kotlinx.serialization copied to clipboard

Mark the generated companion object with @JsExport.Ignore

Open lppedd opened this issue 6 months ago • 0 comments

Let's take the following annotated Kotlin class:

@JsExport
@Serializable
public class ZCSet(
  public val desc: String?,
  public val isSel: Boolean?,
  public val subset: Int?,
)

On Kotlin/JS, when generateTypeScriptDefinitions() is enabled, and because the class is @JsExport-ed, the companion will appear in the generated TS types:

Image

The companion should be marked with @JsExport.Ignore only when it does not exist already.
This avoids kotlinx-serialization marking non-exported something the user wants to export.

lppedd avatar May 24 '25 19:05 lppedd