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

Sharing constants #24

Open
Vlad8161 opened this issue Sep 29, 2020 · 1 comment
Open

Sharing constants #24

Vlad8161 opened this issue Sep 29, 2020 · 1 comment

Comments

@Vlad8161
Copy link

Hello. Is there any way to share constants between kotlin and typescript?

For example:

object ApiConstants {
    const val SOME_VAL_1 = 1234
    const val SOME_VAL_2 = "hello world"
}

Expected TS output:

let ApiConstants = {
    SOME_VAL_1: 1234,
    SOME_VAL_2: "hello world"
}
@brezinajn
Copy link

Disclaimer: I'm not in any way affiliated with development of this library.
I've had the same problem. Solved it with a bit of post processing with enum types (can really share only strings).
Anyway this should be totally possible with kotlin compiler only. Check this https://kotlinlang.org/docs/reference/js-ir-compiler.html

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

2 participants