Summary
For this snippet:
from typing import reveal_type
from random import random
class Baz:
if random():
def method(self) -> int:
return 42
@property
def prop(self) -> int:
return 42
else:
def method(self) -> str:
return "hello"
@property
def prop(self) -> str:
return "hello"
baz = Baz()
reveal_type(baz.prop) # revealed: int , expected: int | str
reveal_type(Baz.prop) # revealed: property, expected: ??
reveal_type(baz.method()) # revealed: int | str ✔️
https://play.ty.dev/c50a02e5-56c0-486b-b599-6d8438678d18
I would expect a union type for baz.prop similar to baz.method().
I am not sure if the second reveal is also problematic.
Version
No response
Summary
For this snippet:
https://play.ty.dev/c50a02e5-56c0-486b-b599-6d8438678d18
I would expect a union type for
baz.propsimilar tobaz.method().I am not sure if the second reveal is also problematic.
Version
No response