title: ApolloClient Type errors for ApolloLink
body: <p>I'm trying to create ApolloClient using TypeScript, but there are some type-errors that I can't resolve. Can anyone point me to right direction what to do?</p>
  <p>Below are the sample code (which is working ok with JavaScript) for creating client:</p>
  <pre><code>import {
    ApolloClient,
    ApolloProvider,
    InMemoryCache,
    split
  } from '@apollo/client';
  
  import { setContext } from 'apollo-link-context';
  import { createHttpLink } from 'apollo-link-http';
  import { getMainDefinition } from '@apollo/client/utilities';
  import { WebSocketLink } from '@apollo/link-ws';
  
  const authLink = setContext((_, { headers }) =&gt; {
    const token = localStorage.getItem('consequat-token');
    return {
      headers: {
        ...headers,
        authorization: token ? `bearer ${token}` : null
      }
    };
  });
  
  const httpLink = createHttpLink({ uri: 'http://localhost:4000' });
  
  const wsLink = new WebSocketLink({
    uri: 'ws://localhost:4000/graphql',
    options: { reconnect: true },
  });
  
  const splitLink = split(
    ({ query }) =&gt; {
      const definition = getMainDefinition(query);
      return (
        definition.kind === 'OperationDefinition' &amp;&amp;
        definition.operation === 'subscription'
      );
    },
    wsLink,
    authLink.concat(httpLink)
  );
  
  const client = new ApolloClient({
    cache: new InMemoryCache(),
    link: splitLink
  });
  </code></pre>
  <p>Problem is that <code>authLink.concat(httpLink)</code> line is complaining:</p>
  <pre><code>Argument of type 'ApolloLink' is not assignable to parameter of type 'ApolloLink | RequestHandler | undefined'.
  Type 'ApolloLink' is missing the following properties from type 'ApolloLink': onError, setOnError ts(2345)
  </code></pre>
  <p>I can't find any answers from Apollo docs or Google.</p>