I have an existing TypedDict containing multiple entries:
from typing import TypedDict
class Params(TypedDict):
param1:str
param2:str
param3:str
I want to create the exact same TypedDict but with all the keys being optional so that the user can specify only certain parameters. I know I can do something like:
class OptionalParams(TypedDict, total=False):
param1:str
param2:str
param3:str
but the problem with this method is that I have to duplicate the code. Is there a way to inherit from Params by making the keys optional ? I tried to do
class OptionalParams(Params, total=False):
pass
but the linter does not understand that the parameters are optional