# Ts2kt and Partial

**URL:** <https://discuss.kotlinlang.org/t/ts2kt-and-partial/6046>\
**Category:** JavaScript\
**Created:** [January 2, 2018, 1:13pm UTC](https://discuss.kotlinlang.org/t/ts2kt-and-partial/6046 "2018-01-02T13:13:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![darksnake](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/darksnake/32/2479_2.png) [@darksnake](https://discuss.kotlinlang.org/u/darksnake)\
**Post date:** [January 2, 2018, 1:13pm UTC](https://discuss.kotlinlang.org/t/ts2kt-and-partial/6046/1 "2018-01-02T13:13:29Z")

</div>

I have yet another stupid (maybe) question about kotlin.js. I am trying to create a browser based visualization for one of my JavaFX projects and for that I am using the `plotly` library`. I can use dynamic type to work with it, but I read about [ts2kt](https://github.com/Kotlin/ts2kt) tool and decided to try it. I took definitions from [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped).  
The conversion completed without errors but with some warnings:

```auto
ts2kt version: 0.0.20
Converting index.d.ts
ts2kt: "NamespaceExportDeclaration" kind unsupported yet here! (index.d.ts:1:1 to 11:28)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:119:21 to 120:18)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:120:35 to 121:18)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:121:26 to 122:18)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:122:26 to 123:15)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:123:32 to 124:18)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:124:26 to 125:18)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:125:26 to 126:14)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:126:25 to 127:14)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:127:25 to 128:19)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:128:29 to 129:19)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:294:29 to 295:14)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:295:22 to 296:14)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:296:23 to 297:13)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:297:20 to 298:14)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:298:66 to 299:18)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:299:27 to 300:17)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:301:33 to 302:17)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:302:37 to 303:16)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:303:24 to 304:18)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:304:38 to 305:15)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:305:35 to 306:23)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:306:32 to 307:18)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:307:27 to 308:18)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:308:27 to 309:19)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:309:41 to 310:20)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:310:30 to 311:15)
ts2kt: "StringLiteral" kind unsupported yet here! (index.d.ts:311:44 to 312:19)

```

The problem is that the result contains a lot of `Partial` class references which is obviously not present in kotlin. Is there a simple way to fix that?

---

<div class="post-metadata">

**Author:** ![bashor](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/bashor/32/1431_2.png) [@bashor](https://discuss.kotlinlang.org/u/bashor)\
**Post date:** [January 16, 2018, 5:59pm UTC](https://discuss.kotlinlang.org/t/ts2kt-and-partial/6046/2 "2018-01-16T17:59:20Z")

</div>

About “StringLiteral” related warnings – unfortunately this declaration use the feature what can’t be expressed in Kotlin now. As an alternative you can add indexer accessor to interfaces when you need to access to members by string name:

```kotlin
external interface ScatterData {
    // ...
    @nativeGetter
    fun get(index: String): Any 
}

///...
data['line.color']

```

`Partial` is not supported yet and more over the new version of ts2kt (0.1.0) you will get `Any?` in such cases.

---

<div class="post-metadata">

**Author:** ![darksnake](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/darksnake/32/2479_2.png) [@darksnake](https://discuss.kotlinlang.org/u/darksnake)\
**Post date:** [January 16, 2018, 6:11pm UTC](https://discuss.kotlinlang.org/t/ts2kt-and-partial/6046/3 "2018-01-16T18:11:35Z")

</div>

For now `Any` is still better because it will compile as is.
