sean
02/26/2020, 7:33 PMJSExport
with the compiler opts. I'm getting out a .js
and .d.ts
file. But when trying to import into a ts
project I'm getting output.d.ts is not a module
The top level looks like
declare namespace output {
type Nullable<T> = T | null | undefined
namespace my.test.project
.....
}
}
Is there an example of how to properly structure / bundle the output into a npm package?Sean Keane
02/26/2020, 7:34 PMSean Keane
02/26/2020, 7:35 PMsean
02/26/2020, 7:39 PMtasks {
...
val compileKotlinJs by getting(org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile::class) {
kotlinOptions {
outputFile = "$projectDir/jsOut/output.js"
sourceMap = true
freeCompilerArgs = listOf("-Xir-produce-js", "-Xgenerate-dts")
}
}
}
Which gives the js
and ts.d
files . i have that going into a folder with a package.json
which then publishes to an npm artifact server. I'm just trying to figure out the import for an actual ts project. It seems like the d.ts
isn't in the expted format? Lot to read through there though.Eivind Nilsbakken
02/27/2020, 7:38 AMd.ts
doesn't look very useful at all, and it would probably be difficult to get to work with our current workarounds of shuffling files around in the buildDir
. I'm hopeful that this use-case will work more or less out of the box in 1.4
.sean
02/28/2020, 4:38 PMts.d
to work. But it's manual intervention.