Skip to content

Commit 64992f9

Browse files
codewizdaveclaude
andcommitted
fix: resolve mypy error for TypedDict callable
Use typing.cast to make mypy understand that TypedDict is callable when creating a NewTypedDict type. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7ba4899 commit 64992f9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/typemap/src/typemap/type_eval/_eval_operators.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,12 @@ def _eval_NewTypedDict(*etyps: Member, ctx):
13211321
name = f"{ctx.current_generic_alias.__name__}[...]"
13221322

13231323
# Create the TypedDict
1324-
return typing.TypedDict(name, annos)
1324+
# Use cast to make mypy happy - TypedDict is callable at runtime
1325+
td_callable = typing.cast(
1326+
typing.Callable[[str, dict[str, object]], type],
1327+
typing.TypedDict,
1328+
)
1329+
return td_callable(name, annos)
13251330

13261331

13271332
@type_eval.register_evaluator(KeyOf)

0 commit comments

Comments
 (0)