Skip to content

Commit 485fd53

Browse files
committed
fix: avoid modern class syntax in build output
1 parent ebb8580 commit 485fd53

2 files changed

Lines changed: 29 additions & 17 deletions

File tree

src/BigIntDecimal.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,10 @@ import {
77
validateNumber,
88
} from './numberUtil';
99

10-
export default class BigIntDecimal implements DecimalClass {
11-
origin: string = '';
12-
negative: boolean;
13-
integer: bigint;
14-
decimal: bigint;
15-
/** BigInt will convert `0009` to `9`. We need record the len of decimal */
16-
decimalLen: number;
17-
empty: boolean;
18-
nan: boolean;
19-
10+
class BigIntDecimal implements DecimalClass {
2011
constructor(value: string | number) {
12+
this.origin = '';
13+
2114
if (isEmpty(value)) {
2215
this.empty = true;
2316
return;
@@ -164,7 +157,7 @@ export default class BigIntDecimal implements DecimalClass {
164157
}
165158

166159
equals(target: DecimalClass) {
167-
return this.toString() === target?.toString();
160+
return this.toString() === (target ? target.toString() : undefined);
168161
}
169162

170163
lessEquals(target: DecimalClass) {
@@ -192,3 +185,16 @@ export default class BigIntDecimal implements DecimalClass {
192185
).fullStr;
193186
}
194187
}
188+
189+
interface BigIntDecimal {
190+
origin: string;
191+
negative: boolean;
192+
integer: bigint;
193+
decimal: bigint;
194+
/** BigInt will convert `0009` to `9`. We need record the len of decimal */
195+
decimalLen: number;
196+
empty: boolean;
197+
nan: boolean;
198+
}
199+
200+
export default BigIntDecimal;

src/NumberDecimal.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import { getNumberPrecision, isE, isEmpty, num2str } from './numberUtil';
44
/**
55
* We can remove this when IE not support anymore
66
*/
7-
export default class NumberDecimal implements DecimalClass {
8-
origin: string = '';
9-
number: number;
10-
empty: boolean;
11-
7+
class NumberDecimal implements DecimalClass {
128
constructor(value: ValueType) {
9+
this.origin = '';
10+
1311
if (isEmpty(value)) {
1412
this.empty = true;
1513
return;
@@ -90,7 +88,7 @@ export default class NumberDecimal implements DecimalClass {
9088
}
9189

9290
equals(target: DecimalClass) {
93-
return this.toNumber() === target?.toNumber();
91+
return this.toNumber() === (target ? target.toNumber() : undefined);
9492
}
9593

9694
lessEquals(target: DecimalClass) {
@@ -117,3 +115,11 @@ export default class NumberDecimal implements DecimalClass {
117115
return num2str(this.number);
118116
}
119117
}
118+
119+
interface NumberDecimal {
120+
origin: string;
121+
number: number;
122+
empty: boolean;
123+
}
124+
125+
export default NumberDecimal;

0 commit comments

Comments
 (0)