Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default value is erased in generated code #36

Open
Ifropc opened this issue Feb 24, 2023 · 0 comments
Open

Default value is erased in generated code #36

Ifropc opened this issue Feb 24, 2023 · 0 comments

Comments

@Ifropc
Copy link

Ifropc commented Feb 24, 2023

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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant