Prototype: Kotlin to TypeScript data-structure transpiler
Kotlin to TypeScript data-structure transpiler
Uses tree-sitter via Node.js bindings with Kotlin grammar
Prototype - proof of concept
Kotlin input:
data class Apple(
var id: Long?,
val color: String,
val size: Int,
val updated: LocalDate
)
Generated TypeScript output:
(At least that is what is planned, we are not there yet)
interface IApple {
readonly id: number | null
readonly color: string
readonly size: number
readonly updated: Date
}
export class Apple implements IApple {
constructor (
public readonly id: number | null,
public readonly color: string,
public readonly size: number,
public readonly updated: Date,
) {}
copy(update: Partial<Apple>): Apple {
return /* new object with updated fields */
}
static from(obj: IApple): Apple {}
}
… tbd …
This project currently uses shadow-cljs to compile ClojureScript. This makes it very easy to add npm dependencies and requires nearly zero configuration.
shadow-cljs server start
Speeds up the following commandsshadow-cljs watch :test
to compile the :test target (and recompile on changes)Pros:
Cons:
Pros:
Cons:
kapt
the Kotlin annotation processing tool is quite slow