I am trying to take an as const array of strings, pass it through a function and have the function return an inverted object where
the array values become keys, and the indexes become values, while preserving full types.
Example:
const FRUIT = invert([
'APPLE',
'BANANA',
'MANGO',
] as const);
I'd like typeof FRUIT to be identical to typeof FRUIT2 from this example:
const FRUIT2 = {
APPLE: 0,
BANANA: 1,
MANGO: 2,
} as const;
Is this possible?