how would this code be converted from a ts2kt head...
# javascript
d
how would this code be converted from a ts2kt header file? to working kotlin?
Copy code
@nativeGetter
operator fun get(key: String): String? // use inline extension with body using dynamic

companion object : QUnit by definedExternally: QUnit { } // can't use delegate on external

fun begin(callback: `(details: `T$3`) -> Unit`) // unresolvable reference details
code here gives errors or deprecated warnings
b
mishaxz: try to use multiline code block
and feel free to report issue to https://github.com/Kotlin/ts2kt/issues/
probably it should be
Copy code
fun begin(callback: (details: `T$3`) -> Unit)
just fix manually
d
issue for that particular line? or for the fact that ts2kt converted files need to be manually edited ?
b
nativeGetter
should work, but deprecated, anyway in IDEA you can apply quickfix (alt+enter)
you can manually fix it for your code, but of course it’s but in ts2kt
d
I don't really understand what "with body using dynamic" means
b
just try 🙂
How about “Use inline extension function with body using dynamic type instead”?
d
@bashor this is my attempt, but I don't know what to put inside the body
Copy code
external interface `T$1`
inline fun `T$1`.get(key: dynamic): String? {

}
b
Why just not use intention?
try press [Alt + Enter] when cursor on annotation
Before:
Copy code
external class A {
    @nativeGetter
    operator fun get(key: String): String?
}
After:
Copy code
external class A {
}

@Suppress("NOTHING_TO_INLINE")
inline operator fun A.get(key: String): String? = asDynamic()[key]