Also has getting this error ' No index signature with a parameter of type 'string' was found on type '{}''
const dnsListObj = {};
for (const key of dnsList) {
dnsListObj[key.id] = key.ipAddr;
}
whats wrong in my code. please help.
const dnsListObj : {[key:string] : any } = {};
for (const key in dnsList) {
dnsListObj[key.id] = key.ipAddr;
}
You can type your dnsListObj so it can accept indexes of type string