<@U6CU87TBM> looks like it’s duplicate of <https:/...
# javascript
b
@eldc looks like it’s duplicate of https://youtrack.jetbrains.com/issue/KT-19177
Could you try compile your code with 1.1.4 EAP?
e
I don't know, how difficult it is to upgrade to 1.1.4 EAP?
I'm still kinda new to the IntelliJ IDE.
b
e
I upgraded to 1.1.4 and it works! Thank you all for your help.
b
You're welcome
h
Hi everyone, I am facing same issue but with
Long.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.61
b
@Himanshu Sharma do you have a selfcontaind example to reproduce?
h
@bashor so my Kotlin common code looks like
Copy code
list.sortedBy { it.fee }.find { (it.fee > 0L && it.minSpend == 0L) }
after running
compileKotlinJs
it generates below JS
Copy code
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 function
apparently
>
was replaced by
compareTo_11rb$
🤷‍♂️
This repo is private I can make a public example for reference
b
which version of Kotlin do you use?
h
1.3.61
b
whould be nice if you could share self-contained example
h
sure will try to share it soon
b
what are type of
fee
and
minSpend
?
h
both are Long
hi @bashor interestingly It worked when I change type of
fee
and
minSpend
to Int instead of Long. looks like a bug to me?
b
probably, but I still can’t reproduce it
i
It's most likely that while the declared type of
fee
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.parse
h
interesting 🤔 . I am indeed doing something similar. so what do you do in this case write a wrapper to convert JS object to kotlin at runtime. I already had to do this to convert JS
Array
to
List
I am writing wrapper to give it a try
b
kotlinx.serialization
could help you to avoid such problems
👍 1
h
Thank you @bashor and @ilya.gorbunov this was indeed the problem.. 🙏
👍 1