Converter of TypeScript definition files to Kotlin declarations
This requires JRE 1.6+ to run. It generates Kotlin files that are compatible with Kotlin 1.1+ (generated declarations are tested against latest stable compiler version)
The simplest way to use is install the latest version form npm:
npm install -g dukat
dukat [<options>] <d.ts files>
where possible options include:
-p <qualifiedPackageName> package name for the generated file (by default filename.d.ts renamed to filename.d.kt)
-m String use this value as @file:JsModule annotation value whenever such annotation occurs
-d <path> destination directory for files with converted declarations (by default declarations are generated in current directory)
-v, -version print version
- clone this project
# on Windows-based platforms set following: `git config core.autocrlf true`
git clone <this project url>
- build
./gradlew build
- (optional) Run unit tests
./gradlew test -Pdukat.test.failure.always
- Minimal CLI support for compiling binary descriptors (this one so far is for dev purposed)
- Some overrides in Typescript are not treated as such in Kotlin, so we have to add reintroduce them to the descendant classes
- Filter out all class parents except the very first one for classes
- In some cases @Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE") was missing.
- Mutliple escaping issues fixes.
- Rename params instead of escaping them (for instance,
object
renamed to justobj
). - Convert UnionType to string whenever it's possible.
- Resolve "import as" clauses and introduce imports accordingly.
- Resolve overrides for nested classes and interfaces.
- Remove conflicting overloads.
- Treat names starting with dot as non-supportable. Unforunately, we need to introduce some changes in Kotlin/JS compiler itself for supporting property names not accessible via dot.
- Always add JsNonModule alongside with JsModule.
- Convert boolean literals to Boolean while converting types.
- Copy methods generated from unrolled union types to ancestor classes.
- equals should have "override" modifier only when param is Any?
- Resolve file names from namespaced nodejs packages.
- Correct override resolving for methods with return type.
- Resolve overrides when return type is generic.
- Replace ReadonlyArray from ts stdlib with just Array.
- Preserve TypeParams in unaliased entities in cases when they were lost.
- Replace entity inherited from a final class (in a Kotlin stdlib sense with alias.