Skip to content

Commit

Permalink
Improving Typescript Enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidmstrr committed Apr 25, 2024
1 parent 155d322 commit 3bba9f1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions components/AmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,19 @@ export default class AmountInput extends React.Component<
super(props);

const { amount, onAmountChange } = props;
let satAmount = '0';
let satAmount: string | number = '0';
if (amount) satAmount = getSatAmount(amount).toString();

onAmountChange(amount, satAmount);
onAmountChange(amount || '', satAmount);
this.state = {
satAmount
};
}

componentDidMount() {
const { amount, onAmountChange }: any = this.props;
const satAmount = getSatAmount(amount);
onAmountChange(amount, satAmount);
const satAmount = getSatAmount(amount || '');
onAmountChange(amount || '', satAmount);
this.setState({ satAmount });
}

Expand All @@ -111,8 +111,8 @@ export default class AmountInput extends React.Component<
onChangeUnits = () => {
const { amount, onAmountChange, UnitsStore }: any = this.props;
UnitsStore.changeUnits();
const satAmount = getSatAmount(amount);
onAmountChange(amount, satAmount);
const satAmount = getSatAmount(amount || '');
onAmountChange(amount || '', satAmount);
this.setState({ satAmount });
};

Expand Down

0 comments on commit 3bba9f1

Please sign in to comment.