const [basicDetails, setBasicDetails] = useState({
companyName: "",
pocName: "",
pocEmail: "",
pocMobile: "",
businessCard: { file: "", type: "", url: "" },
companyBaseAddress: [defaultAddress]
});
const [errorMessage, setErrorMessage] = useState({
companyName: "",
pocName: "",
pocEmail: "",
pocMobile: "",
businessCard: { file: "", type: "", url: "" },
companyBaseAddress: [defaultAddress]
});
const validation = () => {
Object.keys(errorMessage).map((field => basicDetails[field] === "" ?
setErrorMessage(prevState => ({ ...prevState, [field]: "Can not be Empty" })) : null));
};
Error is -> Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ companyName: string; pocName: string; pocEmail: string; pocMobile: string; businessCard: { file: string; type: string; url: string; }; companyBaseAddress: { line1: string; line2: string; city: string; region: string; zip_code: string; country: string; }[]; }'. No index signature with a parameter of type 'string' was found on type '{ companyName: string; pocName: string; pocEmail: string; pocMobile: string; businessCard: { file: string; type: string; url: string; }; companyBaseAddress: { line1: string; line2: string; city: string; region: string; zip_code: string; country: string; }[]; }'