-
-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Labels
Description
This project is fantastic! Nevertheless, there are a few nuances that need to be fixed.
One thing that troubles me is the number conversions. in example code below:
const s = "12345"
const n1 = +s
const n2 = parseInt(s)
if (isNaN(n2)) {
print("Impossible!")
}
Transpiled code below:
s = "12345"
n1 = s
n2 = __TS__ParseInt(s)
if __TS__NumberIsNaN(__TS__Number(n2)) then
print("Impossible!")
end
Code const n1 = +s is wrongly transpiled. It does nothing resulting the wrong type.
isNaN always forces a Number() conversion on the operand, resulting in a performance penalty.
Reactions are currently unavailable