MikeMcl / decimal.js

An arbitrary-precision Decimal type for JavaScript
http://mikemcl.github.io/decimal.js
MIT License
6.35k stars 480 forks source link

Remove toStringTag declaration for type compatibility #211

Closed jon-ressio closed 1 year ago

jon-ressio commented 1 year ago

The goal here is to handle multiple imports of Decimal.js and allow the Decimal type from each import to be used interchangeably. toStringTag in the TypeScript declarations is the only thing preventing that. I've verified that this resolves the linked issue (once Prisma is rebuilt with this Decimal.js change).

MikeMcl commented 1 year ago

I expect another typescript issue will be opened shortly complaining that the property is missing. Anyway, for now I will trust that you know what you are doing...

Thank you for your contribution.

Published in v10.4.3.

jon-ressio commented 1 year ago

I appreciate that.

To talk about alternatives for anyone that might request that the property be re-added...

Since toStringTag was private there's not really much a typescript consumer of Decimal.js could do with it. Stack Overflow Discussion. This change does mean that the string index notation won't work but as any would work and is something we still have to do fairly regularly from typescript-land.