deezer/KustomExport

Default value is erased in generated code

Opened this issue · 0 comments

Having the following code:

@JsExport
class Tester {
  fun test(f: String = "default value"): String {
    return f
  }
}

Will give this ts output:

class Tester {
    constructor();
    test(f?: string): string;
}

Preserving default value. However, using KustomExport on the same code:

@KustomExport
class Tester {
  fun test(f: String = "default value"): String {
    return f
  }
}

Will generate following kotlin code:

public fun test(f: String): String {
    val result = common.test(
        f = f,
    )
    return result
}

As a result, produced typescript definitions have mandatory parameter f:

class Tester {
    constructor();
    test(f: string): string;
}