basedpyright icon indicating copy to clipboard operation
basedpyright copied to clipboard

Fix `TypeGuard`

Open KotlinIsland opened this issue 2 years ago • 2 comments

It's not good

KotlinIsland avatar Mar 29 '24 23:03 KotlinIsland

we should probably also look into whether the new TypeIs fixes any of the same issues that basedmypy's TypeGuard did

DetachHead avatar Mar 30 '24 10:03 DetachHead

Ah yes, TypeIs == basedmypy x is T Pep TypeGuard == basedmypy x is T if True else False

They serve two different purposes and both are needed for different cases.

Apart from that they both exhibit the same unsafe behaviours

KotlinIsland avatar Mar 30 '24 10:03 KotlinIsland