You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What's the recommended way to create Typescript types for sub types of Big with different configs?
I'd like to have unique types for USD vs BTC, mainly to easily identify the value's expected decimal/rounding behavior, that have different configs like so:
USD.DP = 2; // Maximum 2 decimal places for USD
USD.RM = Big.roundHalfUp; // Round to nearest neighbor, away from zero if equidistant
USD.NE = -3; // Exponential notation for values < 0.01
BTC.DP = 8; // Maximum 8 decimal places for BTC
BTC.RM = Big.roundDown; // Round towards zero
BTC.NE = -9; // Exponential notation for values < .00000001.
I've tried a few different methods but none seem to work, either theres type errors or the rounding / precision configs dont seem to take effect.
The text was updated successfully, but these errors were encountered:
capttrousers
changed the title
Question on subclass / extension for different DP/RM/NE configs per subclass
Question on subclass extension for different DP/RM/NE configs per subclass
Jan 2, 2025
capttrousers
changed the title
Question on subclass extension for different DP/RM/NE configs per subclass
Typescript Question on subclass extension for different DP/RM/NE configs per subclass
Jan 2, 2025
What's the recommended way to create Typescript types for sub types of Big with different configs?
I'd like to have unique types for USD vs BTC, mainly to easily identify the value's expected decimal/rounding behavior, that have different configs like so:
I've tried a few different methods but none seem to work, either theres type errors or the rounding / precision configs dont seem to take effect.
The text was updated successfully, but these errors were encountered: