Any suggestions for generating a TypeScript librar...
# multiplatform
j
Any suggestions for generating a TypeScript library in a multiplatform project? I realize I could just manually create all the type definitions inside the JS build product, but that would be, well, manual.
d
Have you tried the TypeScript type definition generation preview in 1.4?
j
I have tried updating my Kotlin and JS plugin versions to 1.4-M1 and am able to build my project but I still don’t see any TS defs in my JS build product. I also set the compiler to
ir
in gradle.properties, FWIW. This is for creating a node library to be used in a separate typescript-based React app.
Relatedly, is there a new version of
kotlinx.serialization
that’s compatible with Kotlin 1.4?
d
You have to enable the new IR backend
And yeah, there's 1.4 compatible versions of all(?) the official libraries. They're mentioned on the 1.4-M1 blog post
j
@Derek Ellis where do I find the typescript definitions though? they aren’t in the js build product
d
I don't think they include them in distributions, but if you just run the webpack task, they'll be in your build
j
hmmm where is the webpack task? do i need to add it to my build gradle somehow?
d
I think it's under the "other" category. I usually just run
jsBrowserWebpackDevelopment
(or Node if you're using that target)
It should be added automatically with your js target(s)