We should be able to use in keyof to index an Array since the index are just numbers. In which case, the following code should work?
Does anybody have any insight into what I'm missing?
function test
<array_T extends {key: string}[]>(input:array_T) :
{[index in keyof array_T]: array_T[index]['key']}
{
return '' as any;
}
***ERROR***
Type '"key"' cannot be used to index type 'array_T[index]'.