@@ -28,7 +28,6 @@ import {
28
28
isObjectType ,
29
29
} from '../../type/definition' ;
30
30
31
- import { applyRequiredStatus } from '../../utilities/applyRequiredStatus' ;
32
31
import { sortValueNode } from '../../utilities/sortValueNode' ;
33
32
import { typeFromAST } from '../../utilities/typeFromAST' ;
34
33
@@ -607,16 +606,34 @@ function findConflict(
607
606
const type2 = def2 ?. type ;
608
607
609
608
if ( type1 && type2 ) {
610
- const modifiedType1 = applyRequiredStatus ( type1 , node1 . nullabilityAssertion ) ;
611
- const modifiedType2 = applyRequiredStatus ( type2 , node2 . nullabilityAssertion ) ;
609
+ // Two fields have different types
610
+ if ( doTypesConflict ( type1 , type2 ) ) {
611
+ return [
612
+ [
613
+ responseName ,
614
+ `they return conflicting types "${ inspect ( type1 ) } " and "${ inspect (
615
+ type2 ,
616
+ ) } "`,
617
+ ] ,
618
+ [ node1 ] ,
619
+ [ node2 ] ,
620
+ ] ;
621
+ }
612
622
613
- if ( doTypesConflict ( modifiedType1 , modifiedType2 ) ) {
623
+ // Two fields have different required operators
624
+ if ( node1 . nullabilityAssertion !== node2 . nullabilityAssertion ) {
614
625
return [
615
626
[
616
627
responseName ,
617
- `they return conflicting types "${ inspect (
618
- modifiedType1 ,
619
- ) } " and "${ inspect ( modifiedType2 ) } "`,
628
+ `they have conflicting nullability designators "${
629
+ node1 . nullabilityAssertion === undefined
630
+ ? ''
631
+ : print ( node1 . nullabilityAssertion )
632
+ } " and "${
633
+ node2 . nullabilityAssertion === undefined
634
+ ? ''
635
+ : print ( node2 . nullabilityAssertion )
636
+ } "`,
620
637
] ,
621
638
[ node1 ] ,
622
639
[ node2 ] ,
0 commit comments