diff --git a/mesonbuild/dependencies/detect.py b/mesonbuild/dependencies/detect.py index 9b41b669aee1..af569fc35140 100644 --- a/mesonbuild/dependencies/detect.py +++ b/mesonbuild/dependencies/detect.py @@ -25,7 +25,7 @@ from .. import mlog if T.TYPE_CHECKING: - from typing_extensions import TypedDict + from typing_extensions import Literal, TypedDict from ..environment import Environment from ..interpreter.kwargs import Dependency as DependencyKw @@ -105,9 +105,11 @@ def get_dep_identifier(name: str, kwargs: DependencyKw) -> DependencyCacheKey: continue # Mypy doesn't (yet) understand iterating a TypedDict, and doesn't know that k is valid if isinstance(v, list): - nkwargs[k] = tuple(v) # type: ignore[literal-required] + k = T.cast("Literal['cmake_args', 'cmake_module_path', 'components', 'modules', 'optional_modules']", k) + nkwargs[k] = tuple(v) else: - nkwargs[k] = v # type: ignore[literal-required] + k = T.cast("Literal['name', 'cmake_package_version', 'language', 'main', 'method', 'private_headers', 'static', 'embed']", k) + nkwargs[k] = v return DependencyCacheKey(name, **nkwargs)