Closed
Description
Overriding one of the type constructors in one of the resolvers in arrayconnection.py breaks the return type of resolver.
For instance:
@dataclass
class CustomConnection:
edges: List[Edge]
pageInfo: PageInfo
# connection is typed as Connection, but it is actually CustomConnection
connection = connection_from_array(
[],
connection_type=CustomConnection,
)
As with issue #29, this can be cleanly resolved using custom Protocol
definitions, although there is the downside noted in that issue of the additional typing-extensions dependency.
Unlike the other issue, I think you could implement a partial solution using Callable
, TypeVar
, and overload
from typing, without having the Protocol
dependency. I'm pretty sure the resulting code would be extremely difficult to understand though, and it would be very verbose.
Metadata
Metadata
Assignees
Labels
No labels