question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular 5 and Apollo definitions error

See original GitHub issue

My Package.json

    "graphql-tag": "^2.5.0",    
    "apollo-angular": "^0.13.3",
    "apollo-client": "^2.0.2",
    "graphql-tag": "^2.5.0",
...
"typescript": "~2.4.2"

Code:

public airlines(): Observable<any> {
        return this.apollo.query({
            query: gql`query getAllAirlines {
              posts: allAirlines {
                id
                name
                color
              }
            }`});
        // return of(this.airlinesData);
    }

client.ts

import { ApolloClient, createNetworkInterface } from 'apollo-client';

// Paste your endpoint for the Simple API here.
// Info: https://github.com/graphcool-examples/angular-apollo-instagram-example#2-create-graphql-api-with-graphcool
const networkInterface = createNetworkInterface({ uri: 'http://localhost:60000/simple/v1/xxxxxx' });

const client = new ApolloClient({ networkInterface });

export function provideClient(): ApolloClient {
  return client;
}

This is the error I’m having:

ERROR in node_modules/apollo-angular/build/src/Apollo.d.ts(2,100): error TS2305: Module '"/Users/danielezurico/Documents/blackswan/iag-management-tool/iag-aircraft-def/node_modules/apollo-client/index"' has no exported member 'ApolloExecutionResult'.
node_modules/apollo-angular/build/src/Apollo.d.ts(11,25): error TS2314: Generic type 'ApolloClient<TCacheShape>' requires 1 type argument(s).
node_modules/apollo-angular/build/src/Apollo.d.ts(16,18): error TS2314: Generic type 'ApolloClient<TCacheShape>' requires 1 type argument(s).
node_modules/apollo-angular/build/src/types.d.ts(3,21): error TS2314: Generic type 'ApolloClient<TCacheShape>' requires 1 type argument(s).
node_modules/apollo-angular/build/src/types.d.ts(5,43): error TS2314: Generic type 'ApolloClient<TCacheShape>' requires 1 type argument(s).
node_modules/apollo-cache/lib/cache.d.ts(1,30): error TS2307: Cannot find module 'graphql'.
node_modules/apollo-cache/lib/types/DataProxy.d.ts(1,30): error TS2307: Cannot find module 'graphql'.
node_modules/apollo-client-rxjs/RxApolloClient.d.ts(2,45): error TS2314: Generic type 'ApolloClient<TCacheShape>' requires 1 type argument(s).
node_modules/apollo-client-rxjs/rxify.d.ts(5,51): error TS2314: Generic type 'ApolloClient<TCacheShape>' requires 1 type argument(s).
node_modules/apollo-client/ApolloClient.d.ts(2,33): error TS2307: Cannot find module 'graphql'.
node_modules/apollo-client/core/ObservableQuery.d.ts(1,30): error TS2307: Cannot find module 'graphql'.
node_modules/apollo-client/core/QueryManager.d.ts(2,30): error TS2307: Cannot find module 'graphql'.
node_modules/apollo-client/core/types.d.ts(1,44): error TS2307: Cannot find module 'graphql'.
node_modules/apollo-client/core/watchQueryOptions.d.ts(1,47): error TS2307: Cannot find module 'graphql'.
node_modules/apollo-client/data/queries.d.ts(1,61): error TS2307: Cannot find module 'graphql'.
node_modules/apollo-client/data/store.d.ts(1,47): error TS2307: Cannot find module 'graphql'.
node_modules/apollo-client/errors/ApolloError.d.ts(1,30): error TS2307: Cannot find module 'graphql'.
node_modules/apollo-client/index.d.ts(1,35): error TS2307: Cannot find module 'graphql/language/printer'.
node_modules/apollo-link/lib/types.d.ts(3,47): error TS2307: Cannot find module 'graphql'.
src/app/client.ts(1,24): error TS2305: Module '"/Users/danielezurico/Documents/blackswan/iag-management-tool/iag-aircraft-def/node_modules/apollo-client/index"' has no exported member 'createNetworkInterface'.
src/app/client.ts(7,35): error TS2345: Argument of type '{ networkInterface: any; }' is not assignable to parameter of type 'ApolloClientOptions<{}>'.
  Object literal may only specify known properties, and 'networkInterface' does not exist in type 'ApolloClientOptions<{}>'.
src/app/client.ts(9,34): error TS2314: Generic type 'ApolloClient<TCacheShape>' requires 1 type argument(s).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kamilkisielacommented, Nov 10, 2017

@daniele-zurico It doesn’t work because v0.X of apollo-angular doesn’t support apollo-client v2.0. Please upgrade to apollo-angular@1.0

0reactions
evanjmgcommented, May 22, 2019

I downgraded Apollo Angular to 1.0.1 and everything works - see the release notes and read me for that version.

On May 21, 2019, at 10:56 PM, William Gutierrez notifications@github.com wrote:

I am with the same issue @evanjmg

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 5 and Apollo definitions error · Issue #392 - GitHub
d.ts(3,21): error TS2314: Generic type 'ApolloClient<TCacheShape>' requires 1 type argument(s). node_modules/apollo-angular/build/src/types.d.ts ...
Read more >
Error handling - Apollo GraphQL Docs
Apollo Server throws errors automatically when applicable. For example, it throws a GRAPHQL_VALIDATION_FAILED error whenever an incoming operation isn't valid ...
Read more >
getting error TS2339: Property 'data' in angular 5 and graphQL ...
It is expecting fields count and data in response of events query but since those fields are not present in events type defined...
Read more >
Apollo Cache – Angular - GraphQL Code Generator
'apollo-angular' · @NgModule({ ... }) class AppModule { constructor( apollo: Apollo, httpLink: HttpLink ) ; => · case 'foo': return object.key; // ...
Read more >
GraphQL Code Libraries, Tools and Services
GitHubapollographql/apollo-client ... JavaScript GraphQL client, designed to work well with React, React Native, Angular 2, or just plain JavaScript.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found