Skip to content

Commit 2381aaa

Browse files
committed
Fix types
1 parent cfa57c5 commit 2381aaa

File tree

3 files changed

+32
-42
lines changed

3 files changed

+32
-42
lines changed

src/api.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// forces vite-plugin-dts to generate types.d.ts
2+
import "./types";
3+
4+
import { from, fromJSON, isDnum, setDecimals, toJSON } from "./dnum";
5+
import { format, formatNumber } from "./formatting";
6+
import { add, div, divide, mul, multiply, sub, subtract } from "./operations";
7+
8+
export type { Decimals, Dnum, Value } from "./types";
9+
10+
export {
11+
add,
12+
div,
13+
divide,
14+
format,
15+
formatNumber,
16+
from,
17+
fromJSON,
18+
isDnum,
19+
mul,
20+
multiply,
21+
setDecimals,
22+
sub,
23+
subtract,
24+
toJSON,
25+
};

src/index.ts

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,4 @@
1-
export type { Decimals, Dnum, Value } from "./types";
2-
3-
import { from, fromJSON, isDnum, setDecimals, toJSON } from "./dnum";
4-
import { format, formatNumber } from "./formatting";
5-
import { add, divide, multiply, subtract } from "./operations";
6-
7-
const div = divide;
8-
const mul = multiply;
9-
const sub = subtract;
10-
11-
export default {
12-
add,
13-
div,
14-
divide,
15-
format,
16-
formatNumber,
17-
from,
18-
fromJSON,
19-
isDnum,
20-
mul,
21-
multiply,
22-
setDecimals,
23-
sub,
24-
subtract,
25-
toJSON,
26-
};
27-
export {
28-
add,
29-
div,
30-
divide,
31-
format,
32-
formatNumber,
33-
from,
34-
fromJSON,
35-
isDnum,
36-
mul,
37-
multiply,
38-
setDecimals,
39-
sub,
40-
subtract,
41-
toJSON,
42-
};
1+
export type { Decimals, Dnum, Value } from "./api";
2+
import * as dnum from "./api";
3+
export * from "./api";
4+
export default dnum;

src/operations.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export function subtract(
5050
decimals,
5151
);
5252
}
53+
export { subtract as sub };
5354

5455
export function multiply(
5556
num1: Numberish,
@@ -74,6 +75,7 @@ export function multiply(
7475
decimals,
7576
);
7677
}
78+
export { multiply as mul };
7779

7880
export function divide(
7981
num1: Numberish,
@@ -103,3 +105,4 @@ export function divide(
103105
decimals,
104106
];
105107
}
108+
export { divide as div };

0 commit comments

Comments
 (0)