Type overloading for get
Drvanon opened this issue · comments
Currently the type overloading for get is interacts mostly with List types. However I frequently use it in mappings as well. e.g.
capitalized_a = py_({lower: upper for lower in "abcdefg"}).get("a").value()
However since the obj type here is at most this:
pydash.objects.get(obj: Any, path: Hashable | List[Hashable], default: Any = None) → Any
I don't get type annotations.
I would suggest the following annotation:
pydash.objects.get(obj: Mapping[T, T2], path: Hashable | List[Hashable], default: Any = None) → T2
Typing this out I am starting to realize why you might not be able to do this, since the path might be deeper than the T2
. Oh well.