I have the following code in one file:
function test<T extends {}>(arg:T):any {
return arg.name
}
In another file, I have this code:
interface IItem {
name: string
}
console.log(test<IItem>({name:'3'}))
When I try to access the name property of the args object, why do I encounter an error? It is not feasible to declare the interface in a file with the test function.