typescript break out of foreach