Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Sealed interface not supportedΒ #38

@GrahamBorland

Description

@GrahamBorland
package ynab.slik.data.repository

import deezer.kustomexport.KustomExport

@KustomExport
sealed interface InvalidDataError

@KustomExport
class InvalidNumber(val number: Int) : InvalidDataError

@KustomExport
class InvalidName(val name: String) : InvalidDataError

This fails to compile:

> Task :lib:compileKotlinJs FAILED
e: file:///Users/graham/Work/YNAB/slik/lib/build/generated/ksp/js/jsMain/kotlin/ynab/slik/data/repository/js/InvalidDataError.kt:11:5 Inheritance of sealed classes or interfaces from different module is prohibited
e: file:///Users/graham/Work/YNAB/slik/lib/build/generated/ksp/js/jsMain/kotlin/ynab/slik/data/repository/js/InvalidDataError.kt:11:5 Inheritor of sealed class or interface declared in package ynab.slik.data.repository.js but it must be in package ynab.slik.data.repository where base class is declared

FAILURE: Build failed with an exception.

If I change the sealed interface to sealed class, then it works.

package ynab.slik.data.repository

import deezer.kustomexport.KustomExport

@KustomExport
sealed class InvalidDataError

@KustomExport
class InvalidNumber(val number: Int) : InvalidDataError()

@KustomExport
class InvalidName(val name: String) : InvalidDataError()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions