I am using VScode 1.91.1. It seems like it doesn’t want to recognize Literal outside of the init method.
class MyDict(TypedDict):
my_var: Literal["a", "b"]
class MyClass:
def __init__(self, my_dict: MyDict):
self.my_var = my_dict["my_var"] # hovering over `my_var` here shows Literal["a", "b"]
def other_method(self):
self.my_var # hovering over it here shows "str"