Skip to content
Converter of TypeScript definition files to Kotlin external declarations
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea Reintroduce gradle build and introduce mocha-backed tests Nov 13, 2018
gradle/wrapper
npm.template
src/main/kotlin
test Reuse project package.json in tests Nov 14, 2018
testData Don't fully qualify reference to types when not needed (#98) Nov 30, 2018
testDefinitelyTyped Generate additional overloads to avoid ambiguity errors when access t… Nov 29, 2017
.gitignore Remove IntelliJ configuration Nov 6, 2018
.gitmodules Migrato to https://github.com/DefinitelyTyped/DefinitelyTyped and upd… Apr 22, 2016
LICENSE
README.md
build.gradle Introduce npm-publishing related tasks to gradle (#123) Nov 15, 2018
common.xml Use ant files to work with nodejs from kotlin repo Jun 21, 2017
gradlew
gradlew.bat Add gradle support Nov 6, 2018
package-lock.json Reintroduce gradle build and introduce mocha-backed tests Nov 13, 2018
package.json Introduce npm-publishing related tasks to gradle (#123) Nov 15, 2018
settings.gradle Reintroduce gradle build and introduce mocha-backed tests Nov 13, 2018
shebang.txt Add scripts for publishing to npm Jun 21, 2017
ts2kt.iml Reintroduce gradle build and introduce mocha-backed tests Nov 13, 2018

README.md

TeamCity (simple build status)

Description

Converter of TypeScript definition files to Kotlin declarations

This requires Kotlin 1.1.x to run. It generates Kotlin files that are compatible with Kotlin 1.1+.

How to use

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

npm install -g ts2kt

Usage

ts2kt [<options>] <d.ts files>

Where possible options include:
-d <path> Destination directory for files with converted declarations, current directory is used by default
-h Print a synopsis of standard options
-X Print a synopsis of advanced options

How to setup project

  1. clone this project
git clone <this project url>
  1. get submodules (https://github.com/DefinitelyTyped/DefinitelyTyped)
git submodule init
git submodule update
  1. Build javascript target (and run the unit tests)
./gradlew build
  1. (optional) Run the unit tests
./gradlew test
  1. Run the tool in one of these ways:
  • Run it with node.js (Note: the root of the project should be working dir):

    node build/distrib/ts2kt.js path/to/input.d.ts path/to/output.kt
  • Directly call translateToFile_puj7f4$ from JS (translateToFile in code).

  • Create run configuration like shared jq and run it.

How to update submodules
git submodule update --remote

Useful links

You can’t perform that action at this time.