Skip to content

Converter of <any kind of declarations> to Kotlin external declarations

Notifications You must be signed in to change notification settings

Maximilian-Seitz/dukat

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

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)

How to install

The simplest way to use is install the latest version form npm:

npm install -g dukat

Usage

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

How to setup and build

  1. clone this project
# on Windows-based platforms set following: `git config core.autocrlf true`   
git clone <this project url>
  1. build
./gradlew build
  1. (optional) Run unit tests
./gradlew test -Pdukat.test.failure.always

Recent Changes

[0.0.25] - 15'January, 2020

  • 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

[0.0.24] - 05'December, 2019

  • 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 just obj).
  • 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.

[0.0.23] - 07'November, 2019

  • 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.

see full CHANGELOG

Useful links

About

Converter of <any kind of declarations> to Kotlin external declarations

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 84.8%
  • WebIDL 10.8%
  • TypeScript 3.8%
  • Other 0.6%