-
Notifications
You must be signed in to change notification settings - Fork 57
Lost type information with addPersistedQueries #25
Comments
Yes, totally agree with this. I think the generics solution should work perfectly. Would you like to submit a PR that implements this? |
Can do, but probably only by next week |
Sure, that sounds great. Please let me know if I can help in some way. |
Okay, is the intended use of Replace:
Enhance:
|
As I see it now with |
Extending on #3 when using other
NetworkInterface
s this type information is lost after calling this function.As the function expects a parameter of type
NetworkInterface
and returns this parameter afterObject.assign
the inferred type isNetworkInterface & { query: Promise<ExecutionResult> }
.Thus all type information of the networkInterface extending
NetworkInterface
is lost.Example
Expectation
Above code should work, since
.use()
is defined onHTTPNetworkInterface
.Actual result
Throws with
Property 'use' does not exist on type 'NetworkInterface & { query: (request: Request) => Promise<ExecutionResult>; }'.
Solution
The solution could look somewhat like this:
The text was updated successfully, but these errors were encountered: