way cleaner than `if (type === 0)`, if (type === 1)`, etc.