Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
/ js-externals Public archive

External declarations for Kotlin/JS

License

Notifications You must be signed in to change notification settings

Kotlin/js-externals

Repository files navigation

External declarations for Kotlin/JS

This repository contains sources of external declarations for Kotlin/JS. The repository is no longer supported and signatures are no longer updated.

How to use?

Bintray

All libraries are available in the maven repositoryhttps://jcenter.bintray / with group idkotlin.js.externalsand artifact idkotlin-js-<library-name>.

To use declarations from a libraryfoo,you need to add this repository to your repository list for your build tool, and then add a dependency tokotlin-js-foo.

Gradle:

repositories{
jcenter()
}

dependencies{
compile"kotlin.js.externals:kotlin-js-foo:$foo_version"
}

Maven:

<repositories>
<repository>
<id>kotlin-js-externals</id>
<name>Kotlin/JS externals</name>
<url>https://jcenter.bintray </url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>kotlin.js.externals</groupId>
<artifactId>kotlin-js-foo</artifactId>
<version>$foo_version</version>
</dependency>
</dependencies>

NPM

All libraries are available on npmjs under@kotlin-externalsscope with the original name. To install declarations for the libraryfooyou must use@kotlin-externals/foo:

npm install --save-dev @kotlin-externals/foo

How to choose version number?

For a JavaScript library of versionX.Y.Z,use an external declarations library with latestX.Yversion.

Sidenote:

This version scheme is required in order to:

  • Obtain simple mapping to/from original library version.
  • Have the ability to update external declarations (a version of external declarations library must have some part independent of a version of the original library).
  • Not use pre-release versions by default (seehttps://docs.npmjs /misc/semver#prerelease-tags).
  • Follow the three number Semver/NPM restriction.

How to contribute?

  • Reportany issues you find in existing declarations.
  • Or fix them and send a Pull Request.
  • Requestdeclarations that are missing.
  • Or create them yourself and send a Pull Request.

Please feel free to ask any questions in#javascriptchannel ofkotl.in/slack

How to write declarations?

To write declarations from scratch or to improve existing declarations you have to read aboutexternal modifierandJS interop annotations.

The simplest way to get external declarations is converting TypeScript declarations (d.ts) to Kotlinusing Dukat.