If my schema has a Decimal field, and I am publishing it via an API (the decimal serializes to a string) how do I ensure my react app (typescript) deserializes the json to an object with the Decimal property?
r
Ryan
09/17/2021, 5:43 AM
@Tyler Clendenin 👋
I think you would need to parse the value to a float wherever you have to use this.
t
Tyler Clendenin
09/17/2021, 1:17 PM
ok, i think it might be useful if the Decimal type could be (in the schema, declaratively) treated as if t was a string. though I don't know enough about TS to know if that won't work
r
Ryan
09/17/2021, 1:21 PM
We use the Decimal.js library under the hood for Decimals so it’s not a string but an instance of the Decimal type.