ember-graphql / ember-apollo-client

🚀 An ember-cli addon for Apollo Client and GraphQL
MIT License
279 stars 72 forks source link

Error using typescript #402

Closed kamalkech closed 3 years ago

kamalkech commented 3 years ago

last version emberjs last version ember-cli-typescript last version ember-apollo-client

i get this error:

error TS7016: Could not find a declaration file for module 'ember-apollo-client'. '/mnt/1C12BBAC12BB8972/Projects/Emberjs/ember-typescript/node_modules/ember-apollo-client/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/ember-apollo-client` if it exists or add a new declaration (.d.ts) file containing `declare module 'ember-apollo-client';`

2 import {queryManager} from 'ember-apollo-client';

and package @types/ember-apollo-client not exist ! any idea ?

josemarluedke commented 3 years ago

Hi @kamalkech! This is expected as ember-apollo-client does not support typescript out of the box.

This is one of the reasons I'm currently working on glimmer-apollo as a replacement for ember-apollo-client.

However, you can inline some type definitions for ember-apollo-client within your application. The types are not perfect but can help a bit: https://gist.github.com/josemarluedke/60d035e86e3d88a3f8a217255b4157e9