What is causing TypeScript to report this error?
"Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ '&': string; '"': string; "'": string; '<': string; '>': string; }'. No index signature with a parameter of type 'string' was found on type '{ '&': string; '"': string; "'": string; '<': string; '>': string; }'.ts(7053)"
Find the error in the Utils.ts file below:
export function escapeHtml(text:string) {
const characters = {
'&': '&',
'"': '"',
"'": ''',
'<': '<',
'>': '>'
};
return text.replace(/[<>&"']/g, function(x) {
return characters[x];
});
}