-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprivatize and export more internal TS definitions #58
Comments
@josemarluedke any thoughts on this? Currently in my app I've worked around this by just creating a declare module 'glimmer-apollo-tmp' {
//redeclared all the missing/private glimmer-apollo types here...
} And just importing from that in my app when I need to import { QueryResource } from 'glimmer-apollo-tmp';
export default class MyRoute extends Route {
setupController(
controller: MyController,
model: QueryResource<MyQuery, MyQueryVariables>,
transition: Transition
) {
super.setupController(controller, model, transition);
//other logic...
}
} I'm happy to put togther a PR for this, unless you have any objections to making those types public. |
👍 @billdami would we very helpful for us as well |
This might even be necessary to make TypeScript understand the return types of useQuery and useMutation etc when it tries to build declarations if you have Currently the problem we run into is TypeScript complaining when it tries to build the declarations as apparently it doesn't take inferred types into account.
Apparently the solution is to import QueryResource and explicitly set the type of See for more info on this: |
We export a set of utility types that allows to extract args and result of useQuery, useMutation and useSubscription. I think we are missing docs for these, but you can import them like so: import type { UseQuery, UseMutation, UseSubscription } from 'glimmer-apollo'; Using them is quite simple: import type { UseQuery } from 'glimmer-apollo';
export default class MyRoute extends Route {
setupController(
controller: MyController,
model: UseQuery<MyQuery, MyQueryVariables>['result'],
transition: Transition
) {
super.setupController(controller, model, transition);
//other logic...
}
} |
It would be helpful for consuming apps to have access to more internal TS types in glimmer-apollo, such as
QueryResource
. When typing things like component arguments, you currently would have to re-define the types if you want to pass in a glimmer-apollo query as an arg, for example:The text was updated successfully, but these errors were encountered: