Open truchi opened 4 years ago
I found the problem
you need to declare the variable type:
const authLink ApolloLink: =
Because there isn't enough overlap, simply typing it as ApolloLink
won't work. This seems to be an issue with the typing in either apollo-link-schema
or @apollo/client
. I'm getting the same issue, my temporary fix is to cast to unknown and then ApolloLink
:
const client = new ApolloClient({
cache: new InMemoryCache(),
link: new SchemaLink({ schema }) as unknown as ApolloLink,
})
Hello,
I am trying to reproduce the README example of apollo-link-schema for mocking purposes and I get the following TypeScript error:
for the line:
Is this a bug or am I doing something wrong?
Thank you!
const mocks = { Query: () => true, // Noob here Mutation: () => true, }
const schema = makeExecutableSchema({ typeDefs }) addMockFunctionsToSchema({ schema, mocks, })
const client = new ApolloClient({ cache: new InMemoryCache(), link: new SchemaLink({ // <-- Errors here schema, }), })
ReactDOM.render(