Skip to content

Commit c9b4ec0

Browse files
committed
introduce FieldSet and GroupedFieldSet types
1 parent 0ba83d8 commit c9b4ec0

File tree

2 files changed

+110
-104
lines changed

2 files changed

+110
-104
lines changed

src/execution/collectFields.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ import { typeFromAST } from '../utilities/typeFromAST.js';
2626

2727
import { getDirectiveValues } from './values.js';
2828

29+
export type FieldSet = ReadonlyArray<FieldNode>;
30+
31+
export type GroupedFieldSet = Map<string, FieldSet>;
32+
2933
export interface PatchFields {
30-
fields: Map<string, ReadonlyArray<FieldNode>>;
34+
fields: GroupedFieldSet;
3135
}
3236

3337
export interface FieldsAndPatches {
34-
fields: Map<string, ReadonlyArray<FieldNode>>;
38+
fields: GroupedFieldSet;
3539
patches: Array<PatchFields>;
3640
}
3741

@@ -84,7 +88,7 @@ export function collectSubfields(
8488
variableValues: { [variable: string]: unknown },
8589
operation: OperationDefinitionNode,
8690
returnType: GraphQLObjectType,
87-
fieldNodes: ReadonlyArray<FieldNode>,
91+
fieldNodes: FieldSet,
8892
): FieldsAndPatches {
8993
const subFieldNodes = new AccumulatorMap<string, FieldNode>();
9094
const visitedFragmentNames = new Set<string>();

0 commit comments

Comments
 (0)