Closed pvl closed 1 year ago
You may need to enable operator overloads in Transcrypt in order for your first example to work. It is turned off by default because it can result in unnecessary code bloat in the transpiled result. You can either use the # __:opov
pragma mechanism to enable it in your code just for the line that needs it, or you can use the --opov
compile switch to turn it on globally if having a larger JS module is not an issue.
Thanks, I confirmed it works ok with the pragma.
I'm very new to Transcrypt, but I'm having some trouble understanding why running this code, as a way to append an item to a list, will make the object of type string. Maybe this can be a bug. newlst = list(mylst) + ["X"] console.log(typeof(newlst)) # prints string
On the other hand, if I run the append this way, it will say it is an object and works as expected newlst = list(mylst) newlst.append("X") console.log(typeof(newlst)) # prints object
Used Transcrypt 3.9.1.