Skip to content
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

Typescript issue in subscription forwarder #210

Closed
JarvisH opened this issue Apr 17, 2024 · 0 comments
Closed

Typescript issue in subscription forwarder #210

JarvisH opened this issue Apr 17, 2024 · 0 comments
Labels
👕 TypeScript Typescript or typing issue

Comments

@JarvisH
Copy link

JarvisH commented Apr 17, 2024

Hello again and thanks for all the hard work on this project!

Using the following example from the documentation:

const subscriptionsHandler = handleSubscriptions(operation => {
  return {
    subscribe: obs => {
      wsClient.subscribe(
        {
          query: operation.query,
          variables: operation.variables,
        },
        obs
      );
      return {
        unsubscribe: () => {
          // No OP
        },
      };
    },
  };
});

operation.query is typed as follows:

interface Operation<TData, TVars> {
    query: string | DocumentNode | DocumentDecoration<TData, TVars>;
    variables?: TVars;
}

wsClient.subscribe however expects the query option to always be a string, and indeed the type coming from Villus IS a string. It appears to be a pure TS issue.

@logaretm logaretm added the 👕 TypeScript Typescript or typing issue label May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👕 TypeScript Typescript or typing issue
Projects
None yet
Development

No branches or pull requests

2 participants