Skip to content
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

fix(typescript-react-apollo): fix the type returned by useSuspenseQuery #878

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/orange-poems-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-codegen/typescript-react-apollo': patch
---

fix return type of useSuspenseQuery
39 changes: 39 additions & 0 deletions dev-test/githunt/types.reactApollo.customSuffix.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,15 @@ export function useCommentLazyQuery(
options,
);
}
// @ts-ignore
export function useCommentSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<CommentQueryMyOperation, CommentQueryVariables>,
): Apollo.UseSuspenseQueryResult<CommentQueryMyOperation, CommentQueryVariables>;
export function useCommentSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
| Apollo.SuspenseQueryHookOptions<CommentQueryMyOperation, CommentQueryVariables>,
): Apollo.UseSuspenseQueryResult<CommentQueryMyOperation | undefined, CommentQueryVariables>;
export function useCommentSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
Expand Down Expand Up @@ -564,6 +573,27 @@ export function useCurrentUserForProfileLazyQuery(
CurrentUserForProfileQueryVariables
>(CurrentUserForProfileDocument, options);
}
// @ts-ignore
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
CurrentUserForProfileQueryMyOperation,
CurrentUserForProfileQueryVariables
>,
): Apollo.UseSuspenseQueryResult<
CurrentUserForProfileQueryMyOperation,
CurrentUserForProfileQueryVariables
>;
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
| Apollo.SuspenseQueryHookOptions<
CurrentUserForProfileQueryMyOperation,
CurrentUserForProfileQueryVariables
>,
): Apollo.UseSuspenseQueryResult<
CurrentUserForProfileQueryMyOperation | undefined,
CurrentUserForProfileQueryVariables
>;
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
Expand Down Expand Up @@ -633,6 +663,15 @@ export function useFeedLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<FeedQueryMyOperation, FeedQueryVariables>(FeedDocument, options);
}
// @ts-ignore
export function useFeedSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<FeedQueryMyOperation, FeedQueryVariables>,
): Apollo.UseSuspenseQueryResult<FeedQueryMyOperation, FeedQueryVariables>;
export function useFeedSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
| Apollo.SuspenseQueryHookOptions<FeedQueryMyOperation, FeedQueryVariables>,
): Apollo.UseSuspenseQueryResult<FeedQueryMyOperation | undefined, FeedQueryVariables>;
export function useFeedSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
Expand Down
34 changes: 34 additions & 0 deletions dev-test/githunt/types.reactApollo.hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,15 @@ export function useCommentLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options);
}
// @ts-ignore
export function useCommentSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<CommentQuery, CommentQueryVariables>,
): Apollo.UseSuspenseQueryResult<CommentQuery, CommentQueryVariables>;
export function useCommentSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
| Apollo.SuspenseQueryHookOptions<CommentQuery, CommentQueryVariables>,
): Apollo.UseSuspenseQueryResult<CommentQuery | undefined, CommentQueryVariables>;
export function useCommentSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
Expand Down Expand Up @@ -604,6 +613,24 @@ export function useCurrentUserForProfileLazyQuery(
options,
);
}
// @ts-ignore
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
CurrentUserForProfileQuery,
CurrentUserForProfileQueryVariables
>,
): Apollo.UseSuspenseQueryResult<CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables>;
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
| Apollo.SuspenseQueryHookOptions<
CurrentUserForProfileQuery,
CurrentUserForProfileQueryVariables
>,
): Apollo.UseSuspenseQueryResult<
CurrentUserForProfileQuery | undefined,
CurrentUserForProfileQueryVariables
>;
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
Expand Down Expand Up @@ -673,6 +700,13 @@ export function useFeedLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options);
}
// @ts-ignore
export function useFeedSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<FeedQuery, FeedQueryVariables>,
): Apollo.UseSuspenseQueryResult<FeedQuery, FeedQueryVariables>;
export function useFeedSuspenseQuery(
baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<FeedQuery, FeedQueryVariables>,
): Apollo.UseSuspenseQueryResult<FeedQuery | undefined, FeedQueryVariables>;
export function useFeedSuspenseQuery(
baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<FeedQuery, FeedQueryVariables>,
) {
Expand Down
34 changes: 34 additions & 0 deletions dev-test/githunt/types.reactApollo.preResolveTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,15 @@ export function useCommentLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options);
}
// @ts-ignore
export function useCommentSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<CommentQuery, CommentQueryVariables>,
): Apollo.UseSuspenseQueryResult<CommentQuery, CommentQueryVariables>;
export function useCommentSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
| Apollo.SuspenseQueryHookOptions<CommentQuery, CommentQueryVariables>,
): Apollo.UseSuspenseQueryResult<CommentQuery | undefined, CommentQueryVariables>;
export function useCommentSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
Expand Down Expand Up @@ -558,6 +567,24 @@ export function useCurrentUserForProfileLazyQuery(
options,
);
}
// @ts-ignore
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
CurrentUserForProfileQuery,
CurrentUserForProfileQueryVariables
>,
): Apollo.UseSuspenseQueryResult<CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables>;
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
| Apollo.SuspenseQueryHookOptions<
CurrentUserForProfileQuery,
CurrentUserForProfileQueryVariables
>,
): Apollo.UseSuspenseQueryResult<
CurrentUserForProfileQuery | undefined,
CurrentUserForProfileQueryVariables
>;
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
Expand Down Expand Up @@ -627,6 +654,13 @@ export function useFeedLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options);
}
// @ts-ignore
export function useFeedSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<FeedQuery, FeedQueryVariables>,
): Apollo.UseSuspenseQueryResult<FeedQuery, FeedQueryVariables>;
export function useFeedSuspenseQuery(
baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<FeedQuery, FeedQueryVariables>,
): Apollo.UseSuspenseQueryResult<FeedQuery | undefined, FeedQueryVariables>;
export function useFeedSuspenseQuery(
baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<FeedQuery, FeedQueryVariables>,
) {
Expand Down
34 changes: 34 additions & 0 deletions dev-test/githunt/types.reactApollo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,15 @@ export function useCommentLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options);
}
// @ts-ignore
export function useCommentSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<CommentQuery, CommentQueryVariables>,
): Apollo.UseSuspenseQueryResult<CommentQuery, CommentQueryVariables>;
export function useCommentSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
| Apollo.SuspenseQueryHookOptions<CommentQuery, CommentQueryVariables>,
): Apollo.UseSuspenseQueryResult<CommentQuery | undefined, CommentQueryVariables>;
export function useCommentSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
Expand Down Expand Up @@ -558,6 +567,24 @@ export function useCurrentUserForProfileLazyQuery(
options,
);
}
// @ts-ignore
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
CurrentUserForProfileQuery,
CurrentUserForProfileQueryVariables
>,
): Apollo.UseSuspenseQueryResult<CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables>;
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
| Apollo.SuspenseQueryHookOptions<
CurrentUserForProfileQuery,
CurrentUserForProfileQueryVariables
>,
): Apollo.UseSuspenseQueryResult<
CurrentUserForProfileQuery | undefined,
CurrentUserForProfileQueryVariables
>;
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?:
| Apollo.SkipToken
Expand Down Expand Up @@ -627,6 +654,13 @@ export function useFeedLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options);
}
// @ts-ignore
export function useFeedSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<FeedQuery, FeedQueryVariables>,
): Apollo.UseSuspenseQueryResult<FeedQuery, FeedQueryVariables>;
export function useFeedSuspenseQuery(
baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<FeedQuery, FeedQueryVariables>,
): Apollo.UseSuspenseQueryResult<FeedQuery | undefined, FeedQueryVariables>;
export function useFeedSuspenseQuery(
baseOptions?: Apollo.SkipToken | Apollo.SuspenseQueryHookOptions<FeedQuery, FeedQueryVariables>,
) {
Expand Down
39 changes: 39 additions & 0 deletions dev-test/githunt/types.reactApollo.v2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,15 @@ export function useCommentLazyQuery(
options,
);
}
// @ts-ignore
export function useCommentSuspenseQuery(
baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<CommentQuery, CommentQueryVariables>,
): ApolloReactHooks.UseSuspenseQueryResult<CommentQuery, CommentQueryVariables>;
export function useCommentSuspenseQuery(
baseOptions?:
| ApolloReactHooks.SkipToken
| ApolloReactHooks.SuspenseQueryHookOptions<CommentQuery, CommentQueryVariables>,
): ApolloReactHooks.UseSuspenseQueryResult<CommentQuery | undefined, CommentQueryVariables>;
export function useCommentSuspenseQuery(
baseOptions?:
| ApolloReactHooks.SkipToken
Expand Down Expand Up @@ -567,6 +576,27 @@ export function useCurrentUserForProfileLazyQuery(
CurrentUserForProfileQueryVariables
>(CurrentUserForProfileDocument, options);
}
// @ts-ignore
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<
CurrentUserForProfileQuery,
CurrentUserForProfileQueryVariables
>,
): ApolloReactHooks.UseSuspenseQueryResult<
CurrentUserForProfileQuery,
CurrentUserForProfileQueryVariables
>;
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?:
| ApolloReactHooks.SkipToken
| ApolloReactHooks.SuspenseQueryHookOptions<
CurrentUserForProfileQuery,
CurrentUserForProfileQueryVariables
>,
): ApolloReactHooks.UseSuspenseQueryResult<
CurrentUserForProfileQuery | undefined,
CurrentUserForProfileQueryVariables
>;
export function useCurrentUserForProfileSuspenseQuery(
baseOptions?:
| ApolloReactHooks.SkipToken
Expand Down Expand Up @@ -638,6 +668,15 @@ export function useFeedLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return ApolloReactHooks.useLazyQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options);
}
// @ts-ignore
export function useFeedSuspenseQuery(
baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<FeedQuery, FeedQueryVariables>,
): ApolloReactHooks.UseSuspenseQueryResult<FeedQuery, FeedQueryVariables>;
export function useFeedSuspenseQuery(
baseOptions?:
| ApolloReactHooks.SkipToken
| ApolloReactHooks.SuspenseQueryHookOptions<FeedQuery, FeedQueryVariables>,
): ApolloReactHooks.UseSuspenseQueryResult<FeedQuery | undefined, FeedQueryVariables>;
export function useFeedSuspenseQuery(
baseOptions?:
| ApolloReactHooks.SkipToken
Expand Down
15 changes: 15 additions & 0 deletions dev-test/star-wars/__generated__/HeroAndFriendsNames.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions dev-test/star-wars/__generated__/HeroAppearsIn.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions dev-test/star-wars/__generated__/HeroDetails.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions dev-test/star-wars/__generated__/HeroDetailsWithFragment.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions dev-test/star-wars/__generated__/HeroName.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading