score:1

Accepted answer

as the error mentions that string is a wrapper object by ts and that parsefloat accepts the first parameter as string.

as for workarounds, you can do one of the following;

string.prototype.tonumber = function() { return parsefloat(this.tostring());}

// or
string.prototype.tonumber = function() { return parsefloat(this as string);}

Related Query

More Query from same tag