basedpyright icon indicating copy to clipboard operation
basedpyright copied to clipboard

`isinstance` check that narrows value to `type` narrows it to `type[Any]` instead of `type[object]` even when `strictGenericNarrowing` is enabled

Open DetachHead opened this issue 10 months ago • 1 comments

Description

Code sample in basedpyright playground

def foo(value: object)-> type[int]:
    assert isinstance(value, type)
    return value # no error

DetachHead avatar Apr 16 '25 07:04 DetachHead

related: #123

DetachHead avatar Apr 16 '25 07:04 DetachHead