I need to create a key value pair type for flat objects, but I keep encountering an error when using it in a global s type file.
// 1. currently using this
type KEY_VALUES = { [k: string | number]: any; };
// 2. I thought it should be like this
type KEY_VALUES = { [k: string | number]: [value: any]; };
1. Error: An index signature parameter type cannot be a union type. Consider using a mapped object type instead.
2. Error: An index signature parameter type cannot be a union type. Consider using a mapped object type instead.
What is the recommended approach to resolve this issue?