Here is a class:
export class Survey {
isCompleted: boolean;
response: {
'devices': string[];
'languages': string[];
'frameworks': string[];
'backend': string[];
};
}
I'm getting the "Element implicitly has an 'any' type because type '...' has no index signature" error when trying the following:
return Object.keys(user1.response).map(key => {
return percentageMatch(user1.response[key], user2.response[key]) * categoryScores[key];
})
user1
and user2
are instances of the Survey
class.
I know how to set an index signature with simple object literals but how do I do it with the properties of the response
object, which is itself a property of the Survey
class.