Having difficulty parsing an Object by changing keynames due to the error message "Element implicitly has an 'any' type because expression of type 'keyof SignInStore' can't be used to index type '{}'".
interface SignInStore {
storeId:number,
storeName:string,
email:string,
destinationName:string,
primaryPhone:string,
}
const signInStore = response.data;
const parseSignInStore:SignInStore = Object.keys(signInStore).reduce((parseStore,param) => {
let newParamName:keyof SignInStore;
switch(param){
case 'id':
newParamName = 'storeId';
break
case 'name':
newParamName = 'storeName';
break
case 'destination_name':
newParamName = 'destinationName';
break
case 'primary_phone':
newParamName = 'primaryPhone';
break
case 'email':
newParamName = 'email';
break
default:
newParamName = param;
}
parseStore[newParamName] = signInStore[param]
return parseStore
},{})
setSignInStore(parseSignInStore);
setIsSignedIn(true);