Closed JonathanPlasse closed 2 months ago
This issue is now fixed.
The return type should be GenericType | DefaultType
; Optional[GenericType]
is only correct if default
is None
:
collection.get('missing', collection[0])
should type as GenericType
collection.get('missing', 'example')
should type as GenericType | str
@Road-hog123
How should we represent DefaultType
in the type annotation?
Like this I think?
DefaultType = typing.TypeVar("DefaultType")
def get(self, key: str | None, default: DefaultType=None) -> GenericType | DefaultType:
...
@Road-hog123
Thanks. Fixed this now.
Hi,
bpy_prop_collection.get()
does not currently have a return type. It should beOptional[GenericType]
.