Closed juancerezo closed 6 months ago
Hi Ivan,
To fix the issue Type hint broken for inject.attr when using ABCMeta just change the order of typing overloads. From more specific to more abstract.
Hasheable type can match with Type[T]. To prevent that, just declare first Hasheable overload and Type[T] later:
Hasheable
Type[T]
I have change this (in all @overload declarations):
@overload
@overload def attr(cls: Type[T]) -> T: ... @overload def attr(cls: Hashable) -> Injectable: ...
To this:
@overload def attr(cls: Hashable) -> Injectable: ... @overload def attr(cls: Type[T]) -> T: ...
Cheers! :)
Sorry, this is a mistake with my code annotations... ^^' I'm continue investigating... :/
It seems that version 5.2.1 and python 3.12 solve the issues with type hinting... :/
Hi Ivan,
To fix the issue Type hint broken for inject.attr when using ABCMeta just change the order of typing overloads. From more specific to more abstract.
Hasheable
type can match withType[T]
. To prevent that, just declare firstHasheable
overload andType[T]
later:I have change this (in all
@overload
declarations):To this:
Cheers! :)