Issues with typescript declarations #8

Closed
opened 2018-08-31 00:25:11 +08:00 by JameeKim · 2 comments
JameeKim commented 2018-08-31 00:25:11 +08:00 (Migrated from github.com)

I was looking for a simple graphql client library and chose this one, and tried to use it in my typescript project. But even before I was able to setup the client instance, several problems stopped me.

  • All the interfaces are hidden (not exported), so I couldn't use them to declare types of my variables
  • As far as I understood by looking into the source code, not all properties in the interceptor objects are required, but the interface FetchQLInterceptor requires them all
  • The return types of the methods in the intercepter objects seem very odd; return Promise.reject(error) in the requestError does not work, even though the README has it as an example
  • There are some typos, like reueqstError in the interceptor or rejedct in the returned object of FetchQL instance methods (and now I realize they should return promises, I guess?)

If someone else can handle this then it is fine, but maybe I can fix some of the issues if that is needed. But I'm not sure if I will understand all underlying things going on in the source code. I also suggest adding typescript as a dev dependency and then testing if the type declarations enable users to successfully compile. Should I start working on this tomorrow? (It's late at night here so I need to go to bed)

I was looking for a simple graphql client library and chose this one, and tried to use it in my typescript project. But even before I was able to setup the client instance, several problems stopped me. * All the interfaces are hidden (not exported), so I couldn't use them to declare types of my variables * As far as I understood by looking into the source code, not all properties in the interceptor objects are required, but the interface FetchQLInterceptor requires them all * The return types of the methods in the intercepter objects seem very odd; `return Promise.reject(error)` in the `requestError` does not work, even though the `README` has it as an example * There are some typos, like `reueqstError` in the interceptor or `rejedct` in the returned object of FetchQL instance methods (and now I realize they should return promises, I guess?) If someone else can handle this then it is fine, but maybe I can fix some of the issues if that is needed. But I'm not sure if I will understand all underlying things going on in the source code. I also suggest adding typescript as a dev dependency and then testing if the type declarations enable users to successfully compile. Should I start working on this tomorrow? (It's late at night here so I need to go to bed)
gucheen commented 2018-09-01 10:34:58 +08:00 (Migrated from github.com)

@JameeKim I've renewed the declaration file in v2.3.0. Please try the new version and check if the declaration file works well.

@JameeKim I've renewed the declaration file in v2.3.0. Please try the new version and check if the declaration file works well.
gucheen commented 2018-09-01 10:36:12 +08:00 (Migrated from github.com)

PRs are welcome.

PRs are welcome.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gucheen/fetchql#8
No description provided.