Skip to content

Commit 3bba9f1

Browse files
committed
Improving Typescript Enhancement
1 parent 155d322 commit 3bba9f1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

components/AmountInput.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,19 @@ export default class AmountInput extends React.Component<
8282
super(props);
8383

8484
const { amount, onAmountChange } = props;
85-
let satAmount = '0';
85+
let satAmount: string | number = '0';
8686
if (amount) satAmount = getSatAmount(amount).toString();
8787

88-
onAmountChange(amount, satAmount);
88+
onAmountChange(amount || '', satAmount);
8989
this.state = {
9090
satAmount
9191
};
9292
}
9393

9494
componentDidMount() {
9595
const { amount, onAmountChange }: any = this.props;
96-
const satAmount = getSatAmount(amount);
97-
onAmountChange(amount, satAmount);
96+
const satAmount = getSatAmount(amount || '');
97+
onAmountChange(amount || '', satAmount);
9898
this.setState({ satAmount });
9999
}
100100

@@ -111,8 +111,8 @@ export default class AmountInput extends React.Component<
111111
onChangeUnits = () => {
112112
const { amount, onAmountChange, UnitsStore }: any = this.props;
113113
UnitsStore.changeUnits();
114-
const satAmount = getSatAmount(amount);
115-
onAmountChange(amount, satAmount);
114+
const satAmount = getSatAmount(amount || '');
115+
onAmountChange(amount || '', satAmount);
116116
this.setState({ satAmount });
117117
};
118118

0 commit comments

Comments
 (0)