diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py index cc8be2d7..adc6cfff 100644 --- a/compiler/api/compiler.py +++ b/compiler/api/compiler.py @@ -115,7 +115,7 @@ def get_type_hint(type: str) -> str: type = f"List[{get_type_hint(sub_type)}]" if is_core: - return f"Union[None, {type}] = None" if is_flag else type + return f"Optional[{type}] = None" if is_flag else type else: ns, name = type.split(".") if "." in type else ("", type) type = f'"raw.base.' + ".".join([ns, name]).strip(".") + '"' diff --git a/compiler/api/template/combinator.txt b/compiler/api/template/combinator.txt index e0275dd1..7c02a1a8 100644 --- a/compiler/api/template/combinator.txt +++ b/compiler/api/template/combinator.txt @@ -5,7 +5,7 @@ from io import BytesIO from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector from pyrogram.raw.core import TLObject from pyrogram import raw -from typing import List, Union, Any +from typing import List, Optional, Any {warning}