The JavaScript function parseInt can be used to force conversion of a given parameter to an integer, whether that parameter is a string, float number, number, etc.
In JavaScript, parseInt(1.2) would yield 1 with no errors, however, in TypeScript, it throws an error during compilation saying:
error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
Am I missing something here or is it an expected behaviour from TypeScript?
parseInt(""+1.2+"")parseInt([2, 3])returns2but that doesn't mean you should do it...parseInt(`${data.adjustProgress}`, 10)so i assumes it is always a string. I find it a bit ridiculous, but hey....we just make due.