Hi, how do I type the key for the return type here?
const getObj = <T extends 'hi' | 'hello'>(value: T) => ({ [value]: value })
const k = getObj('hi') // { [x: string]: T }
I'm not looking to explicitly mention the return type, as the object values call another function with more return types based on inputs
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.