I'm following along with code from this Stack Overflow comment -> https://stackoverflow.com/a/71098593/15592981
I'm following up to a certain point, but when the code creates the capitalizedKey variable, things start to break and I get three main errors.
- Element implicitly has an 'any' type because expression of type '0' can't be used to index type 'keyof OptionalConfig'. Property '0' does not exist on type 'keyof OptionalConfig'.ts(7053)
- Property 'substring' does not exist on type 'keyof OptionalConfig'. Property 'substring' does not exist on type 'number'.ts(2339)
- Type 'K' does not satisfy the constraint 'string'. Type 'keyof OptionalConfig' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'.ts(2344)
Although I've modified the code to use a simpler useMediaQuery hook, they both return booleans and should't effect the overall structure.
Also what is the 'Capitalize' in is${Capitalize<K>} referring to?