Description
The plugin will scan for all classes with @Serializable
. It will convert each to a TypeScript definition.
Nice extras
-
kxs-ts-gen is configurable
-
Add a
@TsExport
annotation so only specific types are generated -
Allow
@TsExport
to be added to const strings, and the raw value will be exported (inspired by Sharing constants ntrrgc/ts-generator#24)@TsExport const val customConfig: String = """ object ApiConstants { const SOME_VAL_1 = 1234 const SOME_VAL_2 = "hello world" } """
kxs-ts-gen will produce
object ApiConstants { const SOME_VAL_1 = 1234 const SOME_VAL_2 = "hello world" }
Or maybe directly convert a const
object ApiConstants { @TsExport const val SOME_VAL_1 = 1234 @TsExport const val SOME_VAL_2 = "hello world" }
kxs-ts-gen will produce
object ApiConstants { const SOME_VAL_1 = 1234 const SOME_VAL_2 = "hello world" }
-
Grab KDoc, and convert it to JSDoc
-
Grab annotations and convert them Feature Request: ability to annotate integer fields ntrrgc/ts-generator#23
-
Add example for NPM upload (with mpetuska/npm-publish?) context
Use KSP to create a plugin. KSP is unsuitable, it can only view and can't run code, use https://github.com/ronmamo/reflections or https://github.com/classgraph/classgraph instead?