Skip to content

TypeIs stops working if there is an error in the TypeIs implementation #19318

Open
@hauntsaninja

Description

@hauntsaninja
from __future__ import annotations
from typing_extensions import TypeIs

class A: ...
class B: ...

def is_A(v: A | B) -> TypeIs[A]:
    return xyz(v)

def main(a: A | B) -> None:
    if is_A(a):
        reveal_type(a)
    else:
        reveal_type(a)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions