I noticed that using decorators that have to do with arrays sort and sortBy, if the value provided to the decorator to sort is null or undefined then the decorator errors out at runtime with something similar to cannot call slice() of undefined. I am providing a guarded value now so that the decorator has an empty array as a source at least. But I wonder if the library itself should guard agains these cases? Like maybe do an array check before calling slice here? https://github.com/pzuraq/macro-decorators/blob/master/src/index.ts#L1163
I noticed that using decorators that have to do with arrays
sort
andsortBy
, if the value provided to the decorator to sort isnull
orundefined
then the decorator errors out at runtime with something similar tocannot call slice() of undefined
. I am providing a guarded value now so that the decorator has an empty array as a source at least. But I wonder if the library itself should guard agains these cases? Like maybe do an array check before calling slice here? https://github.com/pzuraq/macro-decorators/blob/master/src/index.ts#L1163