When trying to format '1234.5' using code like this:
let value: number = 1234.5;
// According to the type definition, value must be a string, number types are not allowed
let formatted: string = Inputmask.default.format(String(value), options);
// Returns '12 345', expected '1 234,5'. Probably because of string conversion.
// Workaround to retain a number type
formatted = Inputmask.default.format(value as unknown as string, options);
// Returns '1 234,5' as expected
Is this an intended behavior (which is most likely) and a type definition issue? Or the value argument must be a string?
This is probably not a bug, more likely a type definition issue, but I just wanted to be sure.
Given following settings, using space as a group separator and comma as a decimal separator:
When trying to format '1234.5' using code like this:
Is this an intended behavior (which is most likely) and a type definition issue? Or the value argument must be a string?