if (allowedSizes.length === 0) {
  return;
}

Then you always return an array and do an early return.