-
Notifications
You must be signed in to change notification settings - Fork 48
Description
I ran into an issue today trying to write to the QLDB database with a Decimal class I built like this:
const decimalNumber = new ion.Decimal('1.0');
When I tried writing this value to QLDB I received this error message:
"Ion Binary: value.writeTo is not a function"
I ended up wrapping decimalNumber with ion.dom.Decimal like so:
const writableDecimal = new ion.dom.Decimal(decimalNumber);
I was then able to write this Decimal value to QLDB.
These two Decimal classes seem to have some of the same usage and functionality, but I don't think it's made very clear that there are multiple Decimal classes in the documentation from what I can see. I'm also not sure if this the correct way to handle a strict string to decimal conversion for ION values.
It might be helpful to just add a string constructor on the ion.dom.Decimal class so I wouldn't need to make multiple hops here:
const decimalNumber = new ion.Decimal('1.0');
const writableDecimal = new ion.dom.Decimal(decimalNumber);