One of the challenges I'm facing involves a function that takes an array of strings and generates an object with those strings as keys. Here's an example:
const obj = arrayToObject(['x', 'y', 'z']); // {x: any, y: any, z: any}
My goal is to have TypeScript dynamically assign types to the returned object based on the array provided in the function arguments. While I am aware that passing the array as a tuple can give me a union type of values, I'm unsure how to proceed from there. Is it even possible to achieve what I'm aiming for?