Skip to content

Make assert_type use ReifiedGeneric so that it can check at runtime #15

Open
@github-actions

Description

@github-actions

Make assert_type use ReifiedGeneric so that it can check at runtime.

# TODO: make this use ReifiedGeneric so that it can check at runtime

class assert_type(Generic[T]):
    """Used to assert that a value is type ``T``.

    note: This is more like a function than a class,
    but it's defined as a class so that you can explicitly specify the generic.
    """

    # TODO: make this use ReifiedGeneric so that it can check at runtime
    # None return type on __new__ is supported in pyright but not mypy
    def __new__(cls, _value: T) -> None:  # type: ignore[misc]
        pass

6accd9872dcd509eea9f2a1ce1cd2138f21bd85f

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions