Is there a way to efficiently access elements in TypeScript using a map with the correct type? When attempting this, an error is thrown due to the type from the map being number | string
type Tuple = [number, number, string];
const y: Tuple = [1, 2, 'apple'];
y[0] // typed as number
y[2] // typed as string
y.map((el, i) => {
if (i === y.length - 1) {
el + 3
} else {
el + "pear"
}
})