Skip to content

Commit

Permalink
fix: Client type explicit default type arg (#12580)
Browse files Browse the repository at this point in the history
  • Loading branch information
iartemiev authored Nov 16, 2023
1 parent 3777b2a commit 4953a58
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
17 changes: 14 additions & 3 deletions packages/adapter-nextjs/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ export {
generateServerClientUsingCookies,
} from './generateServerClient';

export {
V6ClientSSRCookies as ClientUsingSSRCookies,
V6ClientSSRRequest as ClientUsingSSRReq,
import {
V6ClientSSRCookies,
V6ClientSSRRequest,
} from '@aws-amplify/api-graphql';

// explicitly defaulting to `never` here resolves
// TS2589: Type instantiation is excessively deep and possibly infinite.
// When this type is used without a generic type arg, i.e. `let client: Client`
type ClientUsingSSRCookies<T extends Record<any, any> = never> =
V6ClientSSRCookies<T>;

type ClientUsingSSRReq<T extends Record<any, any> = never> =
V6ClientSSRRequest<T>;

export { ClientUsingSSRCookies, ClientUsingSSRReq };
8 changes: 7 additions & 1 deletion packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ export type {
CONNECTION_STATE_CHANGE,
} from '@aws-amplify/api-graphql';

export type { V6Client as Client } from '@aws-amplify/api-graphql';
import type { V6Client } from '@aws-amplify/api-graphql';

// explicitly defaulting to `never` here resolves
// TS2589: Type instantiation is excessively deep and possibly infinite.
// When this type is used without a generic type arg, i.e. `let client: Client`
type Client<T extends Record<any, any> = never> = V6Client<T>;
export { Client };

export {
get,
Expand Down

0 comments on commit 4953a58

Please sign in to comment.