Python Schoolby trefilov
Шаг 1 из 4+130 XP

NewType и TypeGuard

Различаем UserId от int. Сужаем типы.

NewType

from typing import NewType
UserId = NewType("UserId", int)
def get(uid: UserId): ...
get(UserId(5))