Skip to content

Commit

Permalink
add changeset for previous PR 5973
Browse files Browse the repository at this point in the history
  • Loading branch information
lesleydreyer committed Apr 29, 2024
1 parent 9d79ba2 commit 5ee4947
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-bears-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@graphql-tools/merge": patch
---

Fix directive merging when directive name is inherited from object prototype (i.e. toString)
7 changes: 5 additions & 2 deletions packages/merge/src/typedefs-mergers/merge-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,17 @@ export function mergeGraphQLNodes(
break;
case Kind.DIRECTIVE_DEFINITION:
if (mergedResultMap[name]) {
const isInheritedFromPrototype = name in {};
const isInheritedFromPrototype = name in {}; // i.e. toString
if (isInheritedFromPrototype) {
if (!isNode(mergedResultMap[name])) {
mergedResultMap[name] = undefined as any;
}
}
}
mergedResultMap[name] = mergeDirective(nodeDefinition, mergedResultMap[name] as any);
mergedResultMap[name] = mergeDirective(
nodeDefinition,
mergedResultMap[name] as DirectiveDefinitionNode,
);
break;
}
}
Expand Down

0 comments on commit 5ee4947

Please sign in to comment.