Skip to content

Mark the generated companion object with @JsExport.Ignore #3009

Open
@lppedd

Description

@lppedd

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions