Skip to content

Commit

Permalink
Mark mangled globals as TypeAlias
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Apr 24, 2024
1 parent e44c1bc commit 4b7d1cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mypy_protobuf/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def write_enums(
scl + [d.EnumDescriptorProto.VALUE_FIELD_NUMBER],
)
if prefix == "" and not self.readable_stubs:
wl(f"{_mangle_global_identifier(class_name)} = {class_name}")
wl(f"{_mangle_global_identifier(class_name)}: {self._import('typing_extensions', 'TypeAlias')} = {class_name}")
wl("")

def write_messages(
Expand Down Expand Up @@ -483,7 +483,7 @@ def write_messages(

if prefix == "" and not self.readable_stubs:
wl("")
wl(f"{_mangle_global_identifier(class_name)} = {class_name}")
wl(f"{_mangle_global_identifier(class_name)}: {self._import('typing_extensions', 'TypeAlias')} = {class_name}")
wl("")

def write_stringly_typed_fields(self, desc: d.DescriptorProto) -> None:
Expand Down

0 comments on commit 4b7d1cc

Please sign in to comment.