In my function, I am trying to extract data from an object structured by an interface. I want this function to specifically resolve the property data from the data object. While it works when I have any as the return type, I believe there should be a more efficient approach where the return type will match the type of the property.
Here is my current approach: Check out my code here
https://i.sstatic.net/OL8xE.png
Currently, I am only getting back a union type of all properties of the interface, but I am aiming to return the type of the specific property I want.