This repository was archived by the owner on Jun 19, 2023. It is now read-only.
TypeError: Cannot read property 'toString' of nullΒ #118
Open
Description
When I have a field that is either "number" or "string" and I use just the plain decorator "@Attribute()" I get the error "TypeError: Cannot read property 'toString' of null" if the value is null. Evidently there needs to be a check for null somewhere before calling "toString."
It would be nice if it would not throw exceptions for null values.
I have had to work around this by doing the following:
@attribute(
{
type: 'Custom',
marshall: (value) => {
return value ? {N: value.toString()} : null;
},
unmarshall: (attributeValue) => Number(attributeValue.N),
})