I'm currently working on a project using JavaScript and Typescript. I've run into an issue with a function that checks for duplicates in an array, specifically with the error message shown below alongside a snippet of the code.
Error: Property 'toLocaleLowerCase' does not exist on type 'Registration'.ts(2339)
Registration.ts
export interface Registration {
address: string;
comment?: string;
fullname?: string;
}
JS file
const nameAlreadyExist = (name: any): void => {
const nameExist = filteredRegistrationName.value.findIndex((registrationName) =>
registrationName.fullname.toLocaleLowerCase() === name.toLocaleLowerCase());
nameExist != -1 ? (existNameError.value = true) : (existNameError.value = false);
};
If anyone has any insights or suggestions on how to resolve this issue, it would be greatly appreciated. Thank you!