What is the best way to assign a type property of an argument to a generic in TypeScript? Here's the code snippet:
const foo = <T = someObject.bar>(someObject: {[string]: any}): T => {
return someObject.bar
}
How can we set the type of T
to be equal to the value of the bar
property in the object someObject
?