mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Make NewType a class in 3.10 (#6469)
This commit is contained in:
@@ -83,6 +83,15 @@ if sys.version_info >= (3, 10):
|
||||
Concatenate: _SpecialForm = ...
|
||||
TypeAlias: _SpecialForm = ...
|
||||
TypeGuard: _SpecialForm = ...
|
||||
class NewType:
|
||||
def __init__(self, name: str, tp: type) -> None: ...
|
||||
def __call__(self, x: _T) -> _T: ...
|
||||
def __or__(self, other: Any) -> _SpecialForm: ...
|
||||
def __ror__(self, other: Any) -> _SpecialForm: ...
|
||||
__supertype__: type
|
||||
|
||||
else:
|
||||
def NewType(name: str, tp: Type[_T]) -> Type[_T]: ...
|
||||
|
||||
# These type variables are used by the container types.
|
||||
_S = TypeVar("_S")
|
||||
@@ -699,8 +708,6 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
|
||||
def __or__(self: _T, __value: _T) -> _T: ...
|
||||
def __ior__(self: _T, __value: _T) -> _T: ...
|
||||
|
||||
def NewType(name: str, tp: Type[_T]) -> Type[_T]: ...
|
||||
|
||||
# This itself is only available during type checking
|
||||
def type_check_only(func_or_cls: _F) -> _F: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user