#Indexing issue when accessing parameter in object that's typed

1 messages · Page 1 of 1 (latest)

reef blaze
#

I have this problem where i'm getting:
"No index signature with a parameter of type 'string' was found on type", where i'm trying to access a nested object that's typed. I've tried every combination of "keyof typeof" solution i can google, but nothing has worked. It feels like i'm missing something since it shouldn't be this hard to manipulate and the contents of an object.

meager pecan
#

Post code. Read #how-to-get-help

meager pecan
#

key1 is a string. It needs to have a more precise type, telling TypeScript that it is a key of the Configuration interface (since that's what you use it for): key1: keyof Configuration = 'General';