Skip to content

Commit 6f78c0b

Browse files
committed
slight fixes
1 parent c208308 commit 6f78c0b

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/utilities/mapSchemaConfig.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,15 @@ export function mapSchemaConfig(
223223

224224
const mappedSchemaConfig = {
225225
...schemaConfig,
226-
query: schemaConfig.query && getMappedType(schemaConfig.query),
227-
mutation: schemaConfig.mutation && getMappedType(schemaConfig.mutation),
226+
query:
227+
schemaConfig.query &&
228+
(getMappedNamedType(schemaConfig.query.name) as GraphQLObjectType),
229+
mutation:
230+
schemaConfig.mutation &&
231+
(getMappedNamedType(schemaConfig.mutation.name) as GraphQLObjectType),
228232
subscription:
229-
schemaConfig.subscription && getMappedType(schemaConfig.subscription),
233+
schemaConfig.subscription &&
234+
(getMappedNamedType(schemaConfig.subscription.name) as GraphQLObjectType),
230235
types: Array.from(mappedTypeMap.values()),
231236
directives: mappedDirectives,
232237
};
@@ -301,7 +306,10 @@ export function mapSchemaConfig(
301306
const config = type.toConfig();
302307
let mappedConfig: Maybe<MappedGraphQLObjectTypeConfig> = {
303308
...config,
304-
interfaces: () => config.interfaces.map(getMappedType),
309+
interfaces: () =>
310+
config.interfaces.map(
311+
(iface) => getMappedNamedType(iface.name) as GraphQLInterfaceType,
312+
),
305313
fields: () => mapFields(config.fields, type.name),
306314
};
307315
const mapper = configMappersWithHelpers[SchemaElementKind.OBJECT];
@@ -379,7 +387,10 @@ export function mapSchemaConfig(
379387
const config = type.toConfig();
380388
let mappedConfig: Maybe<MappedGraphQLInterfaceTypeConfig> = {
381389
...config,
382-
interfaces: () => config.interfaces.map(getMappedType),
390+
interfaces: () =>
391+
config.interfaces.map(
392+
(iface) => getMappedNamedType(iface.name) as GraphQLInterfaceType,
393+
),
383394
fields: () => mapFields(config.fields, type.name),
384395
};
385396
const mapper = configMappersWithHelpers[SchemaElementKind.INTERFACE];
@@ -394,7 +405,11 @@ export function mapSchemaConfig(
394405
const config = type.toConfig();
395406
let mappedConfig: Maybe<MappedGraphQLUnionTypeConfig> = {
396407
...config,
397-
types: () => config.types.map(getMappedType),
408+
types: () =>
409+
config.types.map(
410+
(memberType) =>
411+
getMappedNamedType(memberType.name) as GraphQLObjectType,
412+
),
398413
};
399414
const mapper = configMappersWithHelpers[SchemaElementKind.UNION];
400415
mappedConfig =

0 commit comments

Comments
 (0)