Erik
10/27/2022, 8:46 PMKashismails
10/28/2022, 9:48 AMandylamax
10/29/2022, 12:29 AMkang wang
10/31/2022, 11:04 AMAyfri
10/31/2022, 6:35 PMAlex
11/01/2022, 7:43 AMTim Lavers
11/01/2022, 8:13 PMAyfri
11/02/2022, 3:17 AMpixi
and I'm facing a problem about dependency management, like @pixi/display
uses typings from @pixi/core
, but only typings, alias import type
in TS, but how should I include the library in my module then ? as I have one gradle module per npm package.Piotr Krzemiński
11/02/2022, 6:39 PMandy
11/04/2022, 7:24 PM@JsExport
on export declarations that use List<>
.
For example, we have many data classes like this:
data class Line(val points = List<Point>)
data class Point(val x: Double, val y: Double)
It’s not possible to use @JsExport
in this case.
There seems to be no good workaround for this. Switching to Array
causes problems for iOS because List
gets exposed as an NSArray
and Array
does not, and besides it would require us to implement hashCode()
manually for the data class. We could add an extension method to the jsMain
source set to access the list as a JS Array, but we’d need to suppress the compiler warnings and it seems like extension methods aren’t supported well with JS/IR either.
I’m wondering, would it be too difficult to add @JsExport
to List
and related collection methods in the standard library? It would be fine if points
in the above example is exposed to Javascript as a List
class transpiled from Kotlin as long as it had some basic interface available from the JS side (size
, get
and toArray()
or toJsArray()
would be fine). Just wondering if this is on the roadmap, or if it is something that could be done as an external contribution (perhaps by us)? Any other ideas of how to workaround this problem if not?gbaldeck
04/28/2017, 1:36 PMIlya Nothen
11/06/2022, 8:55 AMIlya Nothen
11/06/2022, 9:30 AMAyfri
11/07/2022, 8:26 AMimport type
(which is a type of import that doesn't require declaring the dependency imported in package.json
) ?mike.holler
11/08/2022, 4:53 PMError: Timeout of 15000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
Here is my runTest { ... }
function:
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.promise
val testScope = MainScope()
val testCoroutineContext = testScope.coroutineContext
actual fun runTest(
block: suspend (scope: CoroutineScope) -> Unit
): dynamic = testScope.promise(
start = CoroutineStart.UNDISPATCHED,
context = testCoroutineContext,
) {
block(this)
}
And a simple test to verify:
class SimpleTest {
@Test fun testShortDelay() = runTest { delay(10_000) } // passes
@Test fun testLongDelay() = runTest { delay(15_001) } // fails (I want it to pass)
}
Does anybody know what I should change in runTest
to get testLongDelay
and testShortDelay
to both pass? I've tried a number of things and nothing seems to work.mike.holler
11/08/2022, 6:45 PM@Test
fun testLongDelay() = kotlinx.coroutines.test.runTest(dispatchTimeoutMs = 16000) {
withContext(Dispatchers.Default) {
withTimeout(16000) {
delay(15001)
}
}
}
This results in the following error:
Error: Timeout of 15000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
Error: Timeout of 15000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
at <global>.listOnTimeout(node:internal/timers:557)
at <global>.processTimers(node:internal/timers:500)
I'm doing everything I can think of and I still can't figure out how to have a test that:
1. Bypasses the delay skipping mechanic of runTest
2. Is allowed to run for longer than 15000ms
Any and all help is welcome.Mike Dawson
11/10/2022, 9:29 PMLocalizationProvider {
dateAdapter = AdapterDateFns
MobileDatePicker {
componentsProps
asDynamic().onChange = { it: Date ->
println(it.getTime())
}
asDynamic().renderInput = { it: BaseTextFieldProps ->
TextField.create {
onClick = it.onClick
value = it.value
label = it.label
}
}
}
}
Kotlin MUI showcase only has an inline calendar:
https://karakum-team.github.io/kotlin-mui-showcase/#/pickers
I want to use the MUI date pickers as per:
https://mui.com/x/react-date-pickers/getting-started/
Any examples or suggestions? Sorry I'm not that familiar with the JS/React side of things. Do I need to make a new wrapper file with the actual properties, or am I missing something?Mike Dawson
11/10/2022, 9:55 PMasDynamic().renderInput = { it: BaseTextFieldProps ->
TextField.create {
onClick = it.onClick
value = it.value
label = it.label
}
}
Sam Gammon
11/10/2022, 10:08 PMSam Gammon
11/10/2022, 10:08 PMEugene Maksymenko
11/11/2022, 10:18 AMAndreas Martin Mørch
11/14/2022, 1:16 PMSnail
11/15/2022, 3:29 PMexternal fun getEntity(): Int
external fun getVehicle(): Int
external fun testEntity(e: Int)
external fun testVehicle(e: Int)
All of the integers above are sort of handles that i have no control over. Handles have inheritance, e.g. Vehicle extends Entity.
My goal is to have these handles properly typed to have my own extension functions for them.
I have tried using typealiases. The problem with this approach:
typealias Entity = Int
typealias Vehicle = Entity
fun Entity.test() {} // <--
fun Vehicle.test() {} // <-- Both of these are an error because of conflicting overloads
fun Vehicle.getVelocity(): Float = ...
val entity: Entity = ...
entity.getVelocity() // <-- This works, even though it shouldn't. And is also works for every Int which is completely unacceptable
I also tried using value types. Problem: there is no inheritance. You can sort of trick them into having inheritance, but there's another problem:
interface Handle {
val handle: Int
}
interface IEntity : Handle
interface IVehicle : IEntity
value class Entity(override val handle: Int) : IEntity
value class Vehicle(override val handle: Int) : IVehicle
external fun getEntity(): Entity
external fun getVehicle(): Vehicle
external fun testEntity(e: Entity)
external fun testVehicle(e: Vehicle)
external fun testEntity2(e: IEntity)
external fun testVehicle2(e: IVehicle)
val v = getVehicle()
testEntity(v) // Doesn't work! Vehicle doesn't extend from Entity
testEntity2(v) // Works, but IEntity is not value class so under the hood this boxes value of v, which is not acceptable
I could be missing something, but can't figure out a way to solve this. Thoughts?bashor
11/15/2022, 5:46 PMgeorgi
11/16/2022, 10:01 PMcommonMain
module when I use as val parser = DOMParser()
with this error ReferenceError: DOMParser is not defined
. I've checked the docs and it looks like DOMParser should be part of kotlin-stdlib which should automatically be included in Kotlin Multiplatform projects.
What am I missing? Thanks in advance 🙇Sam Gammon
11/17/2022, 11:51 PMVitor Hugo Schwaab
11/18/2022, 10:05 AMjs()
, avoiding the dynamic
type?
For example:
val sentence = "The quick brown fox jumps over the lazy dog"
val index = 4
val charCode = js("sentence.charCodeAt($index)")
// charCode = 113
Tim Lavers
11/19/2022, 2:01 AMcaffeine
11/19/2022, 3:23 AMcompileKotlinJsLegacy
in gradle. How I can find reason and fix? Debug is not work: I set breakpoint on ThrowExceptionReporter.kt:22 but in fact jvm didn't stop on this line.
JsIr builed success
Kotlin: 1.7.21
OS: Ubuntu 22.04
JVM: 17caffeine
11/19/2022, 3:24 AM