m

    Mendess

    4 months ago
    how do I make gradle generate typescript from my multiplatform library? I've been searching for this for a while and I can't figure it out 😔 I have a js target
    kotlin {
        /* Targets configuration omitted.
        *  To find out how to configure the targets, please follow the link:
        *  <https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets> */
    
        jvm()
        js(IR) {
            browser {
                testTask {
                    useKarma {
                        useFirefox()
                    }
                }
            }
        }
    
        sourceSets {
            all {
                languageSettings.apply {
                    optIn("kotlin.js.ExperimentalJsExport")
                }
            }
            val commonMain by getting {
                dependencies {
                    implementation(kotlin("stdlib-common"))
                    implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.2")
                    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2")
                    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1")
                }
            }
            val commonTest by getting {
                dependencies {
                    implementation(kotlin("test"))
                    implementation(kotlin("test-common"))
                    implementation(kotlin("test-annotations-common"))
                    implementation(kotlin("test-annotations-common"))
                }
            }
            val jvmMain by getting { }
            val jvmTest by getting {
                dependencies {
                    implementation(kotlin("test"))
                    implementation(kotlin("test-junit"))
                    implementation("org.junit.jupiter:junit-jupiter:5.8.2")
                    implementation("org.junit.jupiter:junit-jupiter-params:5.8.2")
                    implementation("io.mockk:mockk:1.12.3")
                }
            }
     ...
    found in a random message that I just had to add
    binaries.library()
    inside the
    js(IR) { }
    section