Skip to content

Commit c301c68

Browse files
fix(validate): use referential equality check for type objects
1 parent 144d959 commit c301c68

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/type/validate.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function validateRootTypes(context: SchemaValidationContext): void {
145145
);
146146
}
147147

148-
if (queryType && mutationType && queryType.name === mutationType.name) {
148+
if (queryType && mutationType && queryType === mutationType) {
149149
context.reportError(
150150
'All root types must be different, ' +
151151
queryType.name +
@@ -155,11 +155,7 @@ function validateRootTypes(context: SchemaValidationContext): void {
155155
);
156156
}
157157

158-
if (
159-
queryType &&
160-
subscriptionType &&
161-
queryType.name === subscriptionType.name
162-
) {
158+
if (queryType && subscriptionType && queryType === subscriptionType) {
163159
context.reportError(
164160
'All root types must be different, ' +
165161
queryType.name +
@@ -169,11 +165,7 @@ function validateRootTypes(context: SchemaValidationContext): void {
169165
);
170166
}
171167

172-
if (
173-
mutationType &&
174-
subscriptionType &&
175-
mutationType.name === subscriptionType.name
176-
) {
168+
if (mutationType && subscriptionType && mutationType === subscriptionType) {
177169
context.reportError(
178170
'All root types must be different, ' +
179171
mutationType.name +

0 commit comments

Comments
 (0)