-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type error in SSELink Apollo example #108
Comments
Out of curiosity, I've checked the dependency update one by one. This is caused by updating |
Any solutions here? |
I just downgraded. |
You can always cast to |
I assume it will be fixed eventually, if not I'll probably do that. |
Instead of importing import { ApolloLink, Operation, Observable } from "@apollo/client/core";
import { ExecutionResult, print } from "graphql";
import { createClient, ClientOptions, Client } from "graphql-sse";
export class SSELink extends ApolloLink {
private client: Client;
constructor(options: ClientOptions) {
super();
this.client = createClient(options);
}
public request(operation: Operation): Observable<ExecutionResult> {
return new Observable((sink) => {
return this.client.subscribe<ExecutionResult>(
{ ...operation, query: print(operation.query) },
{
next: sink.next.bind(sink),
complete: sink.complete.bind(sink),
error: sink.error.bind(sink),
},
);
});
}
} |
I confirm, that @RMHonor suggestion sovles the problem. |
Even though #108 (comment) is a fix, I consider this a bug because there's no reason the FetchResult should not work. I think the issue is caused by the lack/improper usage of the patch message in graphql-sse. |
Screenshot
I use code from the example here
Expected Behaviour
The example should work without type errors.
Actual Behaviour
Instead I get the error as shown above.
Further Information
This started showing up when i updated all patch versions of my packages. Likely some typescript instrumentation just caught it, because downgrading back the apollo and graphql packages did not help.The text was updated successfully, but these errors were encountered: