Why am I getting the error? I have added the type properly, right?
Invalid index type "str" for "Union[str, Dict[str, str]]"; expected type "Union[int, slice]"
Code
from typing import List, Dict, Union
d = {"1": 1, "2": 2}
listsOfDicts: List[Dict[str, Union[str, Dict[str, str]]]] = [
{"a": "1", "b": {"c": "1"}},
{"a": "2", "b": {"c": "2"}},
]
[d[i["b"]["c"]] for i in listsOfDicts]