-
Notifications
You must be signed in to change notification settings - Fork 13
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
Export types and classes needed #64
Export types and classes needed #64
Conversation
👷 Deploy request for glimmer-apollo pending review.Visit the deploys page to approve it
|
Hi @bakerac4! We currently export a few type utilities that allow us to make custom queries / pre-defined queries. Exports are here: https://github.com/josemarluedke/glimmer-apollo/blob/main/packages/glimmer-apollo/src/-private/usables.ts Wouldn't that be enough? Here is an usage example: import { gql, useQuery } from 'glimmer-apollo';
import type { UseQuery } from 'glimmer-apollo';
import type {
MyQuery,
MyQueryQueryVariables
} from './my-graphql-types';
export function useMyQuery<
T extends UseQuery<
MyQuery,
MyQueryQueryVariables
>
>(ctx: Object, args?: T['args']): T['return'] {
return useQuery(ctx, () => [
gql`
query MyQuery($id: ID!) {
myQuery(id: $id) {
id
}
}
`,
args ? args() : {}
]);
} |
@bakerac4 I love the custom resource tests, can you rework that to use the type utilities I mentioned above? |
@josemarluedke I believe that fixes part of the issue with types. But for our generic query that sets defaults, you don't have the query type.
|
@bakerac4 Thanks for working on this. |
Released in v0.5.1. |
Fixes #63 and #58