Angular 5 and Apollo definitions error
See original GitHub issueMy 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:
- Created 6 years ago
- Comments:9 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@daniele-zurico It doesn’t work because v0.X of
apollo-angular
doesn’t supportapollo-client
v2.0. Please upgrade toapollo-angular@1.0
I downgraded Apollo Angular to 1.0.1 and everything works - see the release notes and read me for that version.