Skip to content

MyPy: "FSMContext" has incompatible type "FSMData"; expected "dict[str, Any] | None" #1682

@andrew000

Description

@andrew000

set_data and update_data of BaseStorage and SceneWizard accepts Dict[str, Any], but TypedDict is not a subtype of the dict type.

Ref: https://mypy.readthedocs.io/en/stable/typed_dict.html

class FSMData(TypedDict, total=False):
    owner_id: int

await state.update_data(FSMData(owner_id=42))
error: Argument 1 to "update_data" of    
"FSMContext" has incompatible type "FSMData"; expected "dict[str, Any] | None"  [arg-type]                                                            
                FSMData(
                ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions