bashor
08/01/2017, 3:12 PMbashor
08/01/2017, 3:13 PMeldc
08/01/2017, 3:24 PMeldc
08/01/2017, 3:26 PMbashor
08/01/2017, 3:30 PMeldc
08/01/2017, 3:40 PMbashor
08/01/2017, 3:41 PMHimanshu Sharma
01/08/2020, 7:19 PMLong.compareTo .
it leads to runtime error in my JS project compareTo_11rb$ is not a function
has anyone else experienced it?
Kotlin version 1.3.61bashor
01/09/2020, 2:11 PMHimanshu Sharma
01/09/2020, 3:51 PMlist.sortedBy { it.fee }.find { (it.fee > 0L && it.minSpend == 0L) }
after running compileKotlinJs it generates below JS
if (element.list.compareTo_11rb$(L0) > 0 && element.minSpend.compareTo_11rb$(L0) > 0) {
firstOrNull$result = element;
break firstOrNull$break;
}
which fails at runtime compareTo_11rb$ is not a functionHimanshu Sharma
01/09/2020, 3:52 PM> was replaced by compareTo_11rb$ 🤷♂️Himanshu Sharma
01/09/2020, 3:53 PMbashor
01/09/2020, 4:05 PMHimanshu Sharma
01/09/2020, 4:05 PM1.3.61bashor
01/09/2020, 4:06 PMHimanshu Sharma
01/09/2020, 4:06 PMbashor
01/09/2020, 4:06 PMfee and minSpend?Himanshu Sharma
01/09/2020, 4:07 PMHimanshu Sharma
01/09/2020, 4:26 PMfee and minSpend to Int instead of Long.
looks like a bug to me?bashor
01/09/2020, 5:09 PMilya.gorbunov
01/09/2020, 5:52 PMfee and minSpend properties is Long, the actual runtime type is JS Number. It can get there for example if you deserialize your elements from JSON using JSON.parseHimanshu Sharma
01/09/2020, 5:55 PMArray to ListHimanshu Sharma
01/09/2020, 6:00 PMbashor
01/09/2020, 6:02 PMkotlinx.serialization could help you to avoid such problemsHimanshu Sharma
01/09/2020, 6:26 PM