Can someone help me with reversing the key-value pair of an object that contains a nested object value? My code works fine in plain JavaScript, but I'm encountering a compile error when using TypeScript.
The error message states:
Element implicitly has an 'any' type because expression of type 'number' can't be used to index type '{}'. No index signature with a parameter of type 'number' was found on type '{}'.
I would appreciate any advice or suggestions on how to resolve this issue.
Expected Output:
{
"5": "dataCut-1",
"7": "dataCut-2",
"8": "dataCut-3",
"12": "dataCut-4",
"15": "dataCut-5",
"16": "dataCut-6",
"undefined": "dataCut-7"
}