Skip to content

Commit

Permalink
accept number and string on amountAndUnitToString
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed May 4, 2020
1 parent 9fa289e commit fb7e285
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export function amountAndUnitToObject(value: string): AmountAndUnit {
return { amount: parseInt(amount, 10), unit };
}

export function amountAndUnitToString({ amount, unit }: AmountAndUnit) {
export function amountAndUnitToString({
amount,
unit
}: Omit<AmountAndUnit, 'amount'> & { amount: string | number }) {
return `${amount}${unit}`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function FormRow({
onChange(
setting.key,
amountAndUnitToString({
amount: parseInt(e.target.value, 10),
amount: e.target.value,
unit
})
)
Expand Down

0 comments on commit fb7e285

Please sign in to comment.