Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here


Converter of TypeScript definition files to Kotlin external declarations

Subscribe to updates I use ts2kt

Statistics on ts2kt

Number of watchers on Github 185
Number of open issues 26
Average time to close an issue about 1 month
Main language Kotlin
Average time to merge a PR 4 days
Open pull requests 0+
Closed pull requests 8+
Last commit over 1 year ago
Repo Created over 5 years ago
Repo Last Updated over 1 year ago
Size 7.76 MB
Organization / Authorkotlin
Page Updated
Do you use ts2kt? Leave a review!
View open issues (26)
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating ts2kt for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

TeamCity (simple build status)


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


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>
  2. get submodules (

    git submodule init
    git submodule update
  3. install dependencies

    • using installed node.js:
  npm install
  • without installing node.js:
  ant -f build.xml
  ant -f build.xml update.node.modules
  1. setup path to node interpreter in IDEA (Languages & Frameworks | Node.js and NPM)

  2. Convert the tool to Javascript. One way is to open the project in IntelliJ and build the project (e.g. Ctrl+Shift+F9).

  3. (optional) Run the unit tests

ant -f build.xml run.test.for.testData
  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 out/production/ts2kt/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

ts2kt open issues Ask a question     (View All Issues)
  • over 2 years Unable to convert three.js
  • over 2 years @types repo but for kotlin
  • over 2 years Classes marked as "export" on top level are not translated
  • over 2 years Invalid Kotlin Generated from Phaser-ce Typings
  • over 2 years jQuery conversion generates "Overload resolution ambiguity"-prone methods
  • over 2 years Generates invalid Kotlin for Underscore
  • over 2 years Errors converting react-native
  • over 2 years Can't use delegate on external declaration
  • over 2 years Keep comments in d.ts files?
  • over 2 years Output missing imports
  • over 2 years knex.d.ts - ImportDeclaration kind unsupported
  • almost 3 years Verify converted code by kotlinc
ts2kt list of languages used
Other projects in Kotlin