Skip to content

Commit

Permalink
fix(typescript-react-apollo): fix dotansimha#838 - fix the type retur…
Browse files Browse the repository at this point in the history
…ned by useSuspenseQuery
  • Loading branch information
nekocode committed Oct 26, 2024
1 parent 74da8bf commit 97fa403
Show file tree
Hide file tree
Showing 17 changed files with 709 additions and 38 deletions.
57 changes: 54 additions & 3 deletions dev-test/githunt/types.reactApollo.customSuffix.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,14 @@ export function useCommentLazyQuery(
options,
);
}
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 All @@ -510,7 +518,9 @@ export function useCommentSuspenseQuery(
return Apollo.useSuspenseQuery<CommentQueryMyOperation, CommentQueryVariables>(
CommentDocument,
options,
);
) as
| Apollo.UseSuspenseQueryResult<CommentQueryMyOperation, CommentQueryVariables>
| Apollo.UseSuspenseQueryResult<CommentQueryMyOperation | undefined, CommentQueryVariables>;
}
export type CommentQueryHookResult = ReturnType<typeof useCommentQuery>;
export type CommentLazyQueryHookResult = ReturnType<typeof useCommentLazyQuery>;
Expand Down Expand Up @@ -564,6 +574,26 @@ export function useCurrentUserForProfileLazyQuery(
CurrentUserForProfileQueryVariables
>(CurrentUserForProfileDocument, options);
}
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 All @@ -577,7 +607,15 @@ export function useCurrentUserForProfileSuspenseQuery(
return Apollo.useSuspenseQuery<
CurrentUserForProfileQueryMyOperation,
CurrentUserForProfileQueryVariables
>(CurrentUserForProfileDocument, options);
>(CurrentUserForProfileDocument, options) as
| Apollo.UseSuspenseQueryResult<
CurrentUserForProfileQueryMyOperation,
CurrentUserForProfileQueryVariables
>
| Apollo.UseSuspenseQueryResult<
CurrentUserForProfileQueryMyOperation | undefined,
CurrentUserForProfileQueryVariables
>;
}
export type CurrentUserForProfileQueryHookResult = ReturnType<typeof useCurrentUserForProfileQuery>;
export type CurrentUserForProfileLazyQueryHookResult = ReturnType<
Expand Down Expand Up @@ -633,14 +671,27 @@ export function useFeedLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<FeedQueryMyOperation, FeedQueryVariables>(FeedDocument, options);
}
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
| Apollo.SuspenseQueryHookOptions<FeedQueryMyOperation, FeedQueryVariables>,
) {
const options =
baseOptions === Apollo.skipToken ? baseOptions : { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<FeedQueryMyOperation, FeedQueryVariables>(FeedDocument, options);
return Apollo.useSuspenseQuery<FeedQueryMyOperation, FeedQueryVariables>(
FeedDocument,
options,
) as
| Apollo.UseSuspenseQueryResult<FeedQueryMyOperation, FeedQueryVariables>
| Apollo.UseSuspenseQueryResult<FeedQueryMyOperation | undefined, FeedQueryVariables>;
}
export type FeedQueryHookResult = ReturnType<typeof useFeedQuery>;
export type FeedLazyQueryHookResult = ReturnType<typeof useFeedLazyQuery>;
Expand Down
46 changes: 43 additions & 3 deletions dev-test/githunt/types.reactApollo.hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -543,14 +543,24 @@ export function useCommentLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options);
}
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
| Apollo.SuspenseQueryHookOptions<CommentQuery, CommentQueryVariables>,
) {
const options =
baseOptions === Apollo.skipToken ? baseOptions : { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options);
return Apollo.useSuspenseQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options) as
| Apollo.UseSuspenseQueryResult<CommentQuery, CommentQueryVariables>
| Apollo.UseSuspenseQueryResult<CommentQuery | undefined, CommentQueryVariables>;
}
export type CommentQueryHookResult = ReturnType<typeof useCommentQuery>;
export type CommentLazyQueryHookResult = ReturnType<typeof useCommentLazyQuery>;
Expand Down Expand Up @@ -604,6 +614,23 @@ export function useCurrentUserForProfileLazyQuery(
options,
);
}
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 All @@ -617,7 +644,12 @@ export function useCurrentUserForProfileSuspenseQuery(
return Apollo.useSuspenseQuery<CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables>(
CurrentUserForProfileDocument,
options,
);
) as
| Apollo.UseSuspenseQueryResult<CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables>
| Apollo.UseSuspenseQueryResult<
CurrentUserForProfileQuery | undefined,
CurrentUserForProfileQueryVariables
>;
}
export type CurrentUserForProfileQueryHookResult = ReturnType<typeof useCurrentUserForProfileQuery>;
export type CurrentUserForProfileLazyQueryHookResult = ReturnType<
Expand Down Expand Up @@ -673,12 +705,20 @@ export function useFeedLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options);
}
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>,
) {
const options =
baseOptions === Apollo.skipToken ? baseOptions : { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options);
return Apollo.useSuspenseQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options) as
| Apollo.UseSuspenseQueryResult<FeedQuery, FeedQueryVariables>
| Apollo.UseSuspenseQueryResult<FeedQuery | undefined, FeedQueryVariables>;
}
export type FeedQueryHookResult = ReturnType<typeof useFeedQuery>;
export type FeedLazyQueryHookResult = ReturnType<typeof useFeedLazyQuery>;
Expand Down
46 changes: 43 additions & 3 deletions dev-test/githunt/types.reactApollo.preResolveTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,24 @@ export function useCommentLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options);
}
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
| Apollo.SuspenseQueryHookOptions<CommentQuery, CommentQueryVariables>,
) {
const options =
baseOptions === Apollo.skipToken ? baseOptions : { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options);
return Apollo.useSuspenseQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options) as
| Apollo.UseSuspenseQueryResult<CommentQuery, CommentQueryVariables>
| Apollo.UseSuspenseQueryResult<CommentQuery | undefined, CommentQueryVariables>;
}
export type CommentQueryHookResult = ReturnType<typeof useCommentQuery>;
export type CommentLazyQueryHookResult = ReturnType<typeof useCommentLazyQuery>;
Expand Down Expand Up @@ -558,6 +568,23 @@ export function useCurrentUserForProfileLazyQuery(
options,
);
}
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 All @@ -571,7 +598,12 @@ export function useCurrentUserForProfileSuspenseQuery(
return Apollo.useSuspenseQuery<CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables>(
CurrentUserForProfileDocument,
options,
);
) as
| Apollo.UseSuspenseQueryResult<CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables>
| Apollo.UseSuspenseQueryResult<
CurrentUserForProfileQuery | undefined,
CurrentUserForProfileQueryVariables
>;
}
export type CurrentUserForProfileQueryHookResult = ReturnType<typeof useCurrentUserForProfileQuery>;
export type CurrentUserForProfileLazyQueryHookResult = ReturnType<
Expand Down Expand Up @@ -627,12 +659,20 @@ export function useFeedLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options);
}
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>,
) {
const options =
baseOptions === Apollo.skipToken ? baseOptions : { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options);
return Apollo.useSuspenseQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options) as
| Apollo.UseSuspenseQueryResult<FeedQuery, FeedQueryVariables>
| Apollo.UseSuspenseQueryResult<FeedQuery | undefined, FeedQueryVariables>;
}
export type FeedQueryHookResult = ReturnType<typeof useFeedQuery>;
export type FeedLazyQueryHookResult = ReturnType<typeof useFeedLazyQuery>;
Expand Down
46 changes: 43 additions & 3 deletions dev-test/githunt/types.reactApollo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,24 @@ export function useCommentLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options);
}
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
| Apollo.SuspenseQueryHookOptions<CommentQuery, CommentQueryVariables>,
) {
const options =
baseOptions === Apollo.skipToken ? baseOptions : { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options);
return Apollo.useSuspenseQuery<CommentQuery, CommentQueryVariables>(CommentDocument, options) as
| Apollo.UseSuspenseQueryResult<CommentQuery, CommentQueryVariables>
| Apollo.UseSuspenseQueryResult<CommentQuery | undefined, CommentQueryVariables>;
}
export type CommentQueryHookResult = ReturnType<typeof useCommentQuery>;
export type CommentLazyQueryHookResult = ReturnType<typeof useCommentLazyQuery>;
Expand Down Expand Up @@ -558,6 +568,23 @@ export function useCurrentUserForProfileLazyQuery(
options,
);
}
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 All @@ -571,7 +598,12 @@ export function useCurrentUserForProfileSuspenseQuery(
return Apollo.useSuspenseQuery<CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables>(
CurrentUserForProfileDocument,
options,
);
) as
| Apollo.UseSuspenseQueryResult<CurrentUserForProfileQuery, CurrentUserForProfileQueryVariables>
| Apollo.UseSuspenseQueryResult<
CurrentUserForProfileQuery | undefined,
CurrentUserForProfileQueryVariables
>;
}
export type CurrentUserForProfileQueryHookResult = ReturnType<typeof useCurrentUserForProfileQuery>;
export type CurrentUserForProfileLazyQueryHookResult = ReturnType<
Expand Down Expand Up @@ -627,12 +659,20 @@ export function useFeedLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options);
}
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>,
) {
const options =
baseOptions === Apollo.skipToken ? baseOptions : { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options);
return Apollo.useSuspenseQuery<FeedQuery, FeedQueryVariables>(FeedDocument, options) as
| Apollo.UseSuspenseQueryResult<FeedQuery, FeedQueryVariables>
| Apollo.UseSuspenseQueryResult<FeedQuery | undefined, FeedQueryVariables>;
}
export type FeedQueryHookResult = ReturnType<typeof useFeedQuery>;
export type FeedLazyQueryHookResult = ReturnType<typeof useFeedLazyQuery>;
Expand Down
Loading

0 comments on commit 97fa403

Please sign in to comment.