I would like to use the dataclass to define the type and the field (to have the default value) and use TypedDict with typeguard to check the type of each keys in the dictionary. But Pylance doesn't accept this syntax.
from dataclasses import dataclass, field
from typing import TypedDict
from typeguard import typechecked
@dataclass
class Fieldsgetindexopen():
"""Metadata for the request
"""
hedge: bool = field(default_factory=True)
assetclass: str = field(default_factory='ACT')
@typechecked
def test(params : TypedDict('params', Fieldsgetindexopen.__annotations__)):
print('Test')
#Correct
print(test(params = {"hedge" : True, "assetclass" : "ACT"}))
#No Correct
print(test(params = {"hedge" : "True", "assetclass" : "ACT"}))
Do you have any idea to resolve this problem ?
