I tried to use this with Vite's react-ts template. While it works nicely in npm run dev mode, npm run build fails, because TypeScript tries to compile package's .mts file for unknown reason.
Steps to reproduce
Here's a repository where you can reproduce the issue:
git clone https://github.com/ljani/decimal128-tsc-issue
cd decimal128-tsc-issue
npm run ci
npm run build
Expected result
The build completes fine.
Actual result
The build fails with:
node_modules/decimal128/src/Decimal.mts:3:7 - error TS6133: 'ratOne' is declared but its value is never read.
3 const ratOne = new Rational(1n, 1n);
~~~~~~
node_modules/decimal128/src/Decimal.mts:4:7 - error TS6133: 'ratTen' is declared but its value is never read.
4 const ratTen = new Rational(10n, 1n);
~~~~~~
node_modules/decimal128/src/Decimal.mts:49:14 - error TS6133: 'dec' is declared but its value is never read.
49 let [dec, exp] = s.split(/[eE]/);
~~~
node_modules/decimal128/src/Decimal128.mts:45:5 - error TS6133: 'd' is declared but its value is never read.
45 d: "0" | "-0" | Rational,
~
node_modules/decimal128/src/Rational.mts:7:5 - error TS6133: 'ROUNDING_MODE_HALF_EXPAND' is declared but its value is never read.
7 ROUNDING_MODE_HALF_EXPAND,
~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/decimal128/src/Rational.mts:321:9 - error TS6133: 'penultimateDigit' is declared but its value is never read.
321 penultimateDigit: Digit,
~~~~~~~~~~~~~~~~
node_modules/decimal128/src/Rational.mts:337:9 - error TS6133: 'penultimateDigit' is declared but its value is never read.
337 penultimateDigit: Digit,
~~~~~~~~~~~~~~~~
node_modules/decimal128/src/Rational.mts:354:9 - error TS6133: 'penultimateDigit' is declared but its value is never read.
354 penultimateDigit: Digit,
~~~~~~~~~~~~~~~~
node_modules/decimal128/src/Rational.mts:355:9 - error TS6133: 'finalDigit' is declared but its value is never read.
355 finalDigit: Digit,
~~~~~~~~~~
Found 9 errors.
Steps to reproduce (the long way)
npm create vite@latest decimal128-tsc-issue -- --template react-ts
cd decimal128-tsc-issue
npm install
npm install --save decimal128
nvim ./src/App.tsx
# Use decimal128 in App.tsx
npm run build
→ same result
Notes
As this is probably related to packaging of the project, #93 might fix this, but I'm not sure?
This is the only package I've encountered this issue, so I don't think Vite's template is misconfigured
It is tsc -b, which fails, not vite build
Thanks for your work, decimal128 seems a welcome addition to the ecosystem
Summary
I tried to use this with Vite's
react-ts
template. While it works nicely innpm run dev
mode,npm run build
fails, because TypeScript tries to compile package's.mts
file for unknown reason.Steps to reproduce
Here's a repository where you can reproduce the issue:
Expected result
The build completes fine.
Actual result
The build fails with:
Steps to reproduce (the long way)
→ same result
Notes
tsc -b
, which fails, notvite build