damianw / ts2kt

Converter of TypeScript definition files to Kotlin declarations (stubs)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TeamCity (simple build status)

Description

Converter of TypeScript definition files to Kotlin declarations (stubs)

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

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. install dependencies
  • using installed node.js:
npm install
  • without installing node.js:
ant -f build.xml update.tools
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

TypeScript type definitions About git submodules

About

Converter of TypeScript definition files to Kotlin declarations (stubs)


Languages

Language:Kotlin 99.5%Language:JavaScript 0.5%