Is there a way to use "advanced/nested" type variables, similar to how T
is utilized in this function declaration, when working with arrow functions?
function wrapInObject<T>(key: string) {
return (x: T) => ({ [key]: x });
}
I attempted to achieve something like this, but it did not produce the desired result.
const wrapInObject = <T>(key: string) => (x: T) => ({ [key]: x });