Open thrixton opened 4 years ago
I have a model as per below, when I persist it, it's all OK, I can see the numField attribute type is Number in the DynamoDB console.
numField
Number
export class NumTest { public numField: 0 | 1 | 2; public clientId: string; }
However, when I query the object, and check the type with typeof, it returns object.
query
const result = await mapper.query(NumTest, { clientId }, options); console.log(typeof previous.numField); // object
If I take the same object and serialize it to JSON, then deserialize it again, it is correctly typed as number.
const tRes = JSON.parse(JSON.stringify(result))); console.log(typeof tRes.numField); // number
Question Is this expected behaviour?
I have a model as per below, when I persist it, it's all OK, I can see the
numField
attribute type isNumber
in the DynamoDB console.However, when I
query
the object, and check the type with typeof, it returns object.If I take the same object and serialize it to JSON, then deserialize it again, it is correctly typed as number.
Question Is this expected behaviour?