Skip to content

Commit 410760a

Browse files
committed
fix(graphql-codegen): resolve ConnectionResult/PageInfo ambiguity between select-types and input-types
1 parent 259c1ad commit 410760a

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

graphql/codegen/src/__tests__/codegen/__snapshots__/client-generator.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export { QueryBuilder } from "./query-builder";
1616
export * from "./select-types";
1717
export * from "./models";
1818
export * from "./types";
19+
export type { ConnectionResult, PageInfo } from "./select-types";
1920
/**
2021
* Create an ORM client instance
2122
*
@@ -65,6 +66,7 @@ export { QueryBuilder } from "./query-builder";
6566
export * from "./select-types";
6667
export * from "./models";
6768
export * from "./types";
69+
export type { ConnectionResult, PageInfo } from "./select-types";
6870
export { createQueryOperations } from "./query";
6971
export { createMutationOperations } from "./mutation";
7072
/**

graphql/codegen/src/core/codegen/orm/client-generator.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,25 @@ export function generateCreateClientFile(
219219
// Re-export all input types (SecureTableProvision, RelationProvision, Blueprint, etc.)
220220
statements.push(t.exportAllDeclaration(t.stringLiteral('./types')));
221221

222+
// Explicitly resolve ambiguity for types exported by both select-types and types/input-types
223+
// (ConnectionResult, PageInfo are defined in both — prefer the select-types versions)
224+
const ambiguousTypeExport = t.exportNamedDeclaration(
225+
null,
226+
[
227+
t.exportSpecifier(
228+
t.identifier('ConnectionResult'),
229+
t.identifier('ConnectionResult'),
230+
),
231+
t.exportSpecifier(
232+
t.identifier('PageInfo'),
233+
t.identifier('PageInfo'),
234+
),
235+
],
236+
t.stringLiteral('./select-types'),
237+
);
238+
ambiguousTypeExport.exportKind = 'type';
239+
statements.push(ambiguousTypeExport);
240+
222241
// Re-export NodeHttpAdapter when enabled (for use in any Node.js application)
223242
if (options?.nodeHttpAdapter) {
224243
statements.push(

0 commit comments

Comments
 (0)